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.



114
115
116
117
118
# File 'lib/rio/ext/yaml/tie.rb', line 114

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

Instance Attribute Details

#contObject (readonly)

Returns the value of attribute cont.



113
114
115
# File 'lib/rio/ext/yaml/tie.rb', line 113

def cont
  @cont
end

#docObject (readonly)

Returns the value of attribute doc.



112
113
114
# File 'lib/rio/ext/yaml/tie.rb', line 112

def doc
  @doc
end

Instance Method Details

#[](key) ⇒ Object



119
120
121
122
123
124
125
# File 'lib/rio/ext/yaml/tie.rb', line 119

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

#[]=(key, val) ⇒ Object



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

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