Class: Hash
Instance Method Summary
collapse
Instance Method Details
#to_yaml(opts = {}) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/yaml/rubytypes.rb', line 37
def to_yaml( opts = {} )
YAML::quick_emit( self, opts ) do |out|
out.map( taguri, to_yaml_style ) do |map|
each do |k, v|
map.add( k, v )
end
end
end
end
|
#yaml_initialize(tag, val) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/yaml/rubytypes.rb', line 28
def yaml_initialize( tag, val )
if Array === val
update Hash.[]( *val ) elsif Hash === val
update val
else
raise YAML::TypeError, "Invalid map explicitly tagged #{ tag }: " + val.inspect
end
end
|