End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
YAML::DBM#fetch
ydbm.fetch( key, ifnone = nil )
ydbm.fetch( key ) { |key| ... }
lib/yaml/dbm.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/yaml/dbm.rb, line 56
def fetch( keystr, ifnone = nil )
begin
val = super( keystr )
return YAML.load( val ) if String === val
rescue IndexError
end
if block_given?
yield keystr
else
ifnone
end
end
Return value associated with key.
If there is no value for key and no block is given, returns ifnone.
Otherwise, calls block passing in the given key.
See ::DBM#fetch for more information.