YAMLStruct
Takes a YAML document and makes it accessable via a delgate object.
Currently this only supports YAML documents with a map at the top-level. But this should be easy enough to adjust in the future if it proves useful.
Methods
Public Class methods
[ show source ]
# File lib/facets/more/yamlstruct.rb, line 41 def initialize( stream ) @yaml = YAML::load( stream ) end
Public Instance methods
[ show source ]
# File lib/facets/more/yamlstruct.rb, line 45 def method_missing( sym, *args, &blk ) sym = sym.to_s if sym.slice(-1,1) == '=' @yaml[ sym ] = args[0] elsif @yaml.key?( sym ) @yaml[ sym ] else #raise ? end end
[ show source ]
# File lib/facets/more/yamlstruct.rb, line 56 def to_s @yaml.to_yaml end