* ext/syck/lib/syck/dbm.rb: moved to lib/yaml/dbm.rb since it is not

YAML engine specific
* ext/syck/lib/syck/store.rb: moved to lib/yaml/store.rb since it is not
  YAML engine specific.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2010-04-11 01:21:29 +00:00
Родитель 5a7b5e7058
Коммит 48a68756f5
3 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -1,10 +1,10 @@
require 'syck'
require 'yaml'
require 'dbm'
#
# YAML + DBM = YDBM
# - Same interface as DBM class
#
module Syck
module YAML
class DBM < ::DBM
VERSION = "0.1"
@ -17,7 +17,7 @@ class DBM < ::DBM
def fetch( keystr, ifnone = nil )
begin
val = super( keystr )
return Syck.load( val ) if String === val
return YAML.load( val ) if String === val
rescue IndexError
end
if block_given?
@ -35,7 +35,7 @@ class DBM < ::DBM
def delete( key )
v = super( key )
if String === v
v = Syck.load( v )
v = YAML.load( v )
end
v
end
@ -54,11 +54,11 @@ class DBM < ::DBM
self
end
def each_value
super { |v| yield Syck.load( v ) }
super { |v| yield YAML.load( v ) }
self
end
def values
super.collect { |v| Syck.load( v ) }
super.collect { |v| YAML.load( v ) }
end
def has_value?( val )
each_value { |v| return true if v == val }
@ -75,7 +75,7 @@ class DBM < ::DBM
end
def shift
a = super
a[1] = Syck.load( a[1] ) if a
a[1] = YAML.load( a[1] ) if a
a
end
def select( *keys )

Просмотреть файл

@ -1,12 +1,12 @@
#
# YAML::Store
#
require 'syck'
require 'yaml'
require 'pstore'
class Syck::Store < PStore
class YAML::Store < PStore
def initialize( *o )
@opt = Syck::DEFAULTS.dup
@opt = {}
if String === o.first
super(o.shift)
end
@ -20,7 +20,7 @@ class Syck::Store < PStore
end
def load(content)
table = Syck::load(content)
table = YAML.load(content)
if table == false
{}
else

Просмотреть файл

@ -1,5 +1,5 @@
require 'test/unit'
require 'syck/store'
require 'yaml/store'
module Syck
class YAMLStoreTest < Test::Unit::TestCase