fetch( keystr, ifnone = nil )
public
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.
Show source
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