Class: Moult::FlagsReport::Finding

Inherits:
Struct
  • Object
show all
Defined in:
lib/moult/flags_report.rb

Overview

One flag key. Carries its classification (value_type / reference_count / default_values) and reasons so the catalogue is auditable. staleness is a Moult::Flags::Staleness::Assessment when a provider snapshot was merged, else nil. confidence is the staleness candidate's confidence when graded, else null (a reference alone is a fact, the signal is the classification).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_valuesObject

Returns the value of attribute default_values

Returns:

  • (Object)

    the current value of default_values



42
43
44
# File 'lib/moult/flags_report.rb', line 42

def default_values
  @default_values
end

#flag_keyObject

Returns the value of attribute flag_key

Returns:

  • (Object)

    the current value of flag_key



42
43
44
# File 'lib/moult/flags_report.rb', line 42

def flag_key
  @flag_key
end

#occurrencesObject

Returns the value of attribute occurrences

Returns:

  • (Object)

    the current value of occurrences



42
43
44
# File 'lib/moult/flags_report.rb', line 42

def occurrences
  @occurrences
end

#reasonsObject

Returns the value of attribute reasons

Returns:

  • (Object)

    the current value of reasons



42
43
44
# File 'lib/moult/flags_report.rb', line 42

def reasons
  @reasons
end

#reference_countObject

Returns the value of attribute reference_count

Returns:

  • (Object)

    the current value of reference_count



42
43
44
# File 'lib/moult/flags_report.rb', line 42

def reference_count
  @reference_count
end

#stalenessObject

Returns the value of attribute staleness

Returns:

  • (Object)

    the current value of staleness



42
43
44
# File 'lib/moult/flags_report.rb', line 42

def staleness
  @staleness
end

#value_typeObject

Returns the value of attribute value_type

Returns:

  • (Object)

    the current value of value_type



42
43
44
# File 'lib/moult/flags_report.rb', line 42

def value_type
  @value_type
end

Instance Method Details

#to_hObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/moult/flags_report.rb', line 43

def to_h
  h = {
    category: Flags::Classification::CATEGORY,
    confidence: staleness&.confidence,
    flag_key: flag_key,
    value_type: value_type,
    reference_count: reference_count,
    default_values: default_values,
    reasons: reasons.map(&:to_h),
    occurrences: occurrences.map(&:to_h)
  }
  # Additive: the staleness block appears only when graded, leaving the v1
  # finding byte-for-byte unchanged (confidence stays null, no extra key).
  h[:staleness] = staleness.to_h if staleness
  h
end