Class: RIO::Ext::YAML::Tie::Hash

Inherits:
Hash
  • Object
show all
Includes:
Node
Defined in:
lib/rio/ext/yaml/tie.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Node

#dirty=

Constructor Details

#initialize(doc, cont = nil) ⇒ Hash

Returns a new instance of Hash.



128
129
130
131
132
# File 'lib/rio/ext/yaml/tie.rb', line 128

def initialize(doc,cont=nil)
  @doc = doc
  @cont = cont
  super(@doc)
end

Instance Attribute Details

#contObject (readonly)

Returns the value of attribute cont.



127
128
129
# File 'lib/rio/ext/yaml/tie.rb', line 127

def cont
  @cont
end

#docObject (readonly)

Returns the value of attribute doc.



126
127
128
# File 'lib/rio/ext/yaml/tie.rb', line 126

def doc
  @doc
end

Instance Method Details

#[](key) ⇒ Object



133
134
135
136
137
138
139
# File 'lib/rio/ext/yaml/tie.rb', line 133

def [](key)
  val = super
  case val
  when ::Hash then Tie::Hash.new(val,self)
  else val
  end
end

#[]=(key, val) ⇒ Object



140
141
142
143
# File 'lib/rio/ext/yaml/tie.rb', line 140

def []=(key,val)
  self.dirty = true
  super
end