mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
979de48915
[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
29 lines
405 B
Ruby
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
|