Class: JvYAML::JvYAMLi::Map
- Inherits:
-
Node
- Object
- Node
- JvYAML::JvYAMLi::Map
show all
- Defined in:
- lib/jvyaml.rb
Instance Attribute Summary
Attributes inherited from Node
#style, #type_id, #value
Instance Method Summary
collapse
Methods inherited from Node
from_internal, #to_s, #to_str, #transform
Constructor Details
#initialize(type_id, val, style) ⇒ Map
Returns a new instance of Map.
205
206
207
208
209
210
|
# File 'lib/jvyaml.rb', line 205
def initialize(type_id, val, style)
@kind = :map
self.type_id = type_id
self.value = val
self.style = style
end
|
Instance Method Details
#add(k, v) ⇒ Object
211
212
213
|
# File 'lib/jvyaml.rb', line 211
def add(k, v)
@value[k] = v
end
|
#to_internal ⇒ Object
215
216
217
|
# File 'lib/jvyaml.rb', line 215
def to_internal
org.jvyamlb.nodes.MappingNode.new(self.type_id, self.value.inject({}) {|h, v| h[v[0].to_internal] = v[1].to_internal ;h }, self.style)
end
|
#to_jvyaml_node(repr) ⇒ Object
219
220
221
|
# File 'lib/jvyaml.rb', line 219
def to_jvyaml_node(repr)
repr.map(self.type_id,self.value,self.style)
end
|