Class: SuperDiff::OperationalSequencers::CustomObject

Inherits:
DefaultObject show all
Defined in:
lib/super_diff/operational_sequencers/custom_object.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DefaultObject

#initialize

Methods inherited from Base

#call

Constructor Details

This class inherits a constructor from SuperDiff::OperationalSequencers::DefaultObject

Class Method Details

.applies_to?(expected, actual) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'lib/super_diff/operational_sequencers/custom_object.rb', line 4

def self.applies_to?(expected, actual)
  expected.class == actual.class &&
    expected.respond_to?(:attributes_for_super_diff) &&
    actual.respond_to?(:attributes_for_super_diff)
end

Instance Method Details

#attribute_namesObject



15
16
17
18
# File 'lib/super_diff/operational_sequencers/custom_object.rb', line 15

def attribute_names
  expected.attributes_for_super_diff.keys &
    actual.attributes_for_super_diff.keys
end

#build_operation_sequencerObject



10
11
12
13
# File 'lib/super_diff/operational_sequencers/custom_object.rb', line 10

def build_operation_sequencer
  # XXX This assumes that `expected` and `actual` are the same
  OperationSequences::CustomObject.new([], value_class: expected.class)
end