aboutsummaryrefslogtreecommitdiffstats
path: root/lib/yaml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yaml')
-rw-r--r--lib/yaml/dbm.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/yaml/dbm.rb b/lib/yaml/dbm.rb
index 07441f53ad..976fdb3bb6 100644
--- a/lib/yaml/dbm.rb
+++ b/lib/yaml/dbm.rb
@@ -57,10 +57,20 @@ class DBM < ::DBM
end
# Deprecated, used YAML::DBM#key instead.
+ # ----
+ # Note:
+ # YAML::DBM#index makes warning from internal of ::DBM#index.
+ # It says 'DBM#index is deprecated; use DBM#key', but DBM#key
+ # behaves not same as DBM#index.
+ #
def index( keystr )
super( keystr.to_yaml )
end
+ def key( keystr )
+ invert[keystr]
+ end
+
# Returns an array containing the values associated with the given keys.
def values_at( *keys )
keys.collect { |k| fetch( k ) }
@@ -185,8 +195,8 @@ class DBM < ::DBM
#
# Returns +self+.
def update( hsh )
- hsh.keys.each do |k|
- self.store( k, hsh.fetch( k ) )
+ hsh.each_pair do |k,v|
+ self.store( k, v )
end
self
end