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
matz 979de48915 * lib/pstore.rb (transaction): allow overriding dump and load.
[ruby-dev:23567]

* lib/yaml/store.rb: follow lib/pstore.rb's change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-27 07:43:38 +00:00

29 lines
405 B
Ruby

#
# 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