Class: Igniter::Extensions::Contracts::Dataflow::Diff

Inherits:
Struct
  • Object
show all
Defined in:
lib/igniter/extensions/contracts/dataflow/diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#addedObject

Returns the value of attribute added

Returns:

  • (Object)

    the current value of added



7
8
9
# File 'lib/igniter/extensions/contracts/dataflow/diff.rb', line 7

def added
  @added
end

#changedObject

Returns the value of attribute changed

Returns:

  • (Object)

    the current value of changed



7
8
9
# File 'lib/igniter/extensions/contracts/dataflow/diff.rb', line 7

def changed
  @changed
end

#removedObject

Returns the value of attribute removed

Returns:

  • (Object)

    the current value of removed



7
8
9
# File 'lib/igniter/extensions/contracts/dataflow/diff.rb', line 7

def removed
  @removed
end

#unchangedObject

Returns the value of attribute unchanged

Returns:

  • (Object)

    the current value of unchanged



7
8
9
# File 'lib/igniter/extensions/contracts/dataflow/diff.rb', line 7

def unchanged
  @unchanged
end

Instance Method Details

#any_changes?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/igniter/extensions/contracts/dataflow/diff.rb', line 8

def any_changes?
  added.any? || removed.any? || changed.any?
end

#explainObject



16
17
18
19
20
21
22
23
# File 'lib/igniter/extensions/contracts/dataflow/diff.rb', line 16

def explain
  parts = []
  parts << "added(#{added.size}): #{added.inspect}" unless added.empty?
  parts << "removed(#{removed.size}): #{removed.inspect}" unless removed.empty?
  parts << "changed(#{changed.size}): #{changed.inspect}" unless changed.empty?
  parts << "unchanged(#{unchanged.size})" unless unchanged.empty?
  parts.empty? ? "(no changes)" : parts.join(", ")
end

#processed_countObject



12
13
14
# File 'lib/igniter/extensions/contracts/dataflow/diff.rb', line 12

def processed_count
  added.size + changed.size
end

#to_hObject



25
26
27
28
29
30
31
32
# File 'lib/igniter/extensions/contracts/dataflow/diff.rb', line 25

def to_h
  {
    added: added,
    removed: removed,
    changed: changed,
    unchanged: unchanged
  }
end