Class: SuperDiff::Basic::OperationTrees::DefaultObject

Inherits:
Core::AbstractOperationTree show all
Defined in:
lib/super_diff/basic/operation_trees/default_object.rb

Direct Known Subclasses

CustomObject

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Core::AbstractOperationTree

#==, #flatten, #perhaps_elide, #to_diff

Constructor Details

#initialize(operations, underlying_object:) ⇒ DefaultObject

Returns a new instance of DefaultObject.



13
14
15
16
# File 'lib/super_diff/basic/operation_trees/default_object.rb', line 13

def initialize(operations, underlying_object:)
  super(operations)
  @underlying_object = underlying_object
end

Instance Attribute Details

#underlying_objectObject (readonly)

Returns the value of attribute underlying_object.



11
12
13
# File 'lib/super_diff/basic/operation_trees/default_object.rb', line 11

def underlying_object
  @underlying_object
end

Class Method Details

.applies_to?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/super_diff/basic/operation_trees/default_object.rb', line 7

def self.applies_to?(*)
  true
end

Instance Method Details

#pretty_print(pp) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/super_diff/basic/operation_trees/default_object.rb', line 18

def pretty_print(pp)
  pp.text "#<#{self.class.name} "
  pp.nest(1) do
    pp.breakable
    pp.text ':operations=>'
    pp.group(1, '[', ']') do
      pp.breakable
      pp.seplist(self) { |value| pp.pp value }
    end
    pp.comma_breakable
    pp.text ':underlying_object=>'
    pp.object_address_group underlying_object do
      # do nothing
    end
  end
  pp.text '>'
end