Class: TypedEnums::Output::Writer::Result

Inherits:
Data
  • Object
show all
Defined in:
lib/typed_enums/output/writer/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#changedObject (readonly)

Returns the value of attribute changed

Returns:

  • (Object)

    the current value of changed



6
7
8
# File 'lib/typed_enums/output/writer/result.rb', line 6

def changed
  @changed
end

#conflictsObject (readonly)

Returns the value of attribute conflicts

Returns:

  • (Object)

    the current value of conflicts



6
7
8
# File 'lib/typed_enums/output/writer/result.rb', line 6

def conflicts
  @conflicts
end

#extraObject (readonly)

Returns the value of attribute extra

Returns:

  • (Object)

    the current value of extra



6
7
8
# File 'lib/typed_enums/output/writer/result.rb', line 6

def extra
  @extra
end

#missingObject (readonly)

Returns the value of attribute missing

Returns:

  • (Object)

    the current value of missing



6
7
8
# File 'lib/typed_enums/output/writer/result.rb', line 6

def missing
  @missing
end

#unchangedObject (readonly)

Returns the value of attribute unchanged

Returns:

  • (Object)

    the current value of unchanged



6
7
8
# File 'lib/typed_enums/output/writer/result.rb', line 6

def unchanged
  @unchanged
end

Instance Method Details

#applied_summaryObject



26
27
28
29
30
31
32
33
34
# File 'lib/typed_enums/output/writer/result.rb', line 26

def applied_summary
  {
    "created" => missing,
    "updated" => changed,
    "removed" => extra
  }.filter_map do |label, files|
    "#{label}: #{files.join(', ')}" if files.any?
  end.join("\n")
end

#conflict?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/typed_enums/output/writer/result.rb', line 11

def conflict?
  conflicts.any?
end

#stale?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/typed_enums/output/writer/result.rb', line 7

def stale?
  changed.any? || missing.any? || extra.any? || conflicts.any?
end

#summaryObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/typed_enums/output/writer/result.rb', line 15

def summary
  {
    "conflicts" => conflicts,
    "missing" => missing,
    "changed" => changed,
    "extra" => extra
  }.filter_map do |label, files|
    "#{label}: #{files.join(', ')}" if files.any?
  end.join("\n")
end