1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/yaml/store.rb

30 lines
405 B
Ruby
Raw Normal View History

#
# YAML::Store
#
require 'yaml'
require 'pstore'
class YAML::Store < PStore
def initialize( *o )
@opt = YAML::DEFAULTS.dup
if String === o.first
super(o.shift)
end
if o.last.is_a? Hash
@opt.update(o.pop)
end
end
def dump(table)
@table.to_yaml(@opt)
end
def load(content)
YAML::load(content)
end
def load_file(file)
YAML::load(file)
end
end