Class: Psych::Pure::LoadedObject

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/psych/pure.rb

Overview

Wraps a Ruby object with its node from the source input.

Direct Known Subclasses

LoadedArray

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, psych_node) ⇒ LoadedObject

Returns a new instance of LoadedObject.



225
226
227
228
229
# File 'lib/psych/pure.rb', line 225

def initialize(object, psych_node)
  super(object)
  @psych_node = psych_node
  @dirty = false
end

Instance Attribute Details

#dirtyObject (readonly)

Whether or not this object has been modified. If it has, then we cannot rely on the source formatting, and need to format it ourselves.



223
224
225
# File 'lib/psych/pure.rb', line 223

def dirty
  @dirty
end

#psych_nodeObject (readonly)

The node associated with the object.



219
220
221
# File 'lib/psych/pure.rb', line 219

def psych_node
  @psych_node
end

Instance Method Details

#initialize_clone(obj, freeze: nil) ⇒ Object



231
232
233
234
# File 'lib/psych/pure.rb', line 231

def initialize_clone(obj, freeze: nil)
  super
  @psych_node = obj.psych_node.dup
end

#initialize_dup(obj) ⇒ Object



236
237
238
239
# File 'lib/psych/pure.rb', line 236

def initialize_dup(obj)
  super
  @psych_node = obj.psych_node.dup
end