mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/yaml/dbm/dbm.rb: fix #update, add #key for using istead #index.
[Bug #5305][ruby-dev:44485] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fecda0d9f7
commit
73bd9e566b
2 changed files with 17 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Sep 25 20:54:10 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
|
||||
|
||||
* lib/yaml/dbm/dbm.rb: fix #update, add #key for using istead #index.
|
||||
[Bug #5305][ruby-dev:44485]
|
||||
|
||||
Sun Sep 25 16:54:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* encoding.c (require_enc): reject only loading from untrusted
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue