diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-11 01:21:29 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-11 01:21:29 +0000 |
commit | 48a68756f5813a078d3c69a4180a9102208f953b (patch) | |
tree | f750d83fcd4a0e071a19ce00591907da10d317b9 | |
parent | 5a7b5e70587a5b0fdd0fc1bbfa0d98d665e70970 (diff) | |
download | ruby-48a68756f5813a078d3c69a4180a9102208f953b.tar.gz |
* 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
-rw-r--r-- | lib/yaml/dbm.rb (renamed from ext/syck/lib/syck/dbm.rb) | 14 | ||||
-rw-r--r-- | lib/yaml/store.rb (renamed from ext/syck/lib/syck/store.rb) | 8 | ||||
-rw-r--r-- | test/syck/test_yamlstore.rb | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/ext/syck/lib/syck/dbm.rb b/lib/yaml/dbm.rb index 95611afb04..973e88dbc7 100644 --- a/ext/syck/lib/syck/dbm.rb +++ b/lib/yaml/dbm.rb @@ -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 ) diff --git a/ext/syck/lib/syck/store.rb b/lib/yaml/store.rb index 8f27cf49c0..a7f8a5657d 100644 --- a/ext/syck/lib/syck/store.rb +++ b/lib/yaml/store.rb @@ -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 diff --git a/test/syck/test_yamlstore.rb b/test/syck/test_yamlstore.rb index e78a7e4ecb..971c75bf27 100644 --- a/test/syck/test_yamlstore.rb +++ b/test/syck/test_yamlstore.rb @@ -1,5 +1,5 @@ require 'test/unit' -require 'syck/store' +require 'yaml/store' module Syck class YAMLStoreTest < Test::Unit::TestCase |