Class: SuperDiff::OperationTrees::DefaultObject

Inherits:
Base
  • Object
show all
Defined in:
lib/super_diff/operation_trees/default_object.rb

Direct Known Subclasses

CustomObject

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#flatten, #perhaps_elide, #to_diff

Constructor Details

#initialize(operations, underlying_object:) ⇒ DefaultObject

Returns a new instance of DefaultObject.



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

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.



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

def underlying_object
  @underlying_object
end

Class Method Details

.applies_to?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/super_diff/operation_trees/default_object.rb', line 4

def self.applies_to?(*)
  true
end

Instance Method Details

#pretty_print(pp) ⇒ Object



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

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) do |value|
        pp.pp value
      end
    end
    pp.comma_breakable
    pp.text ":underlying_object=>"
    pp.object_address_group underlying_object do
      # do nothing
    end
  end
  pp.text ">"
end