mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/yaml.rb, lib/yaml/: [DOC] Document YAML::DBM#key and add
references to similar methods with more detail. This patch brings lib/yaml to 100% documentation coverage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4852e7e673
commit
8a896179ad
3 changed files with 18 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Mon Aug 12 12:46:31 2013 Zachary Scott <e@zzak.io>
|
||||||
|
|
||||||
|
* lib/yaml.rb, lib/yaml/: [DOC] Document YAML::DBM#key and add
|
||||||
|
references to similar methods with more detail. This patch brings
|
||||||
|
lib/yaml to 100% documentation coverage.
|
||||||
|
|
||||||
Mon Aug 12 02:51:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
Mon Aug 12 02:51:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* ext/readline/readline.c (readline_s_set_input): on OS X with editline,
|
* ext/readline/readline.c (readline_s_set_input): on OS X with editline,
|
||||||
|
|
|
@ -10,7 +10,7 @@ rescue LoadError
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
YAML = Psych
|
YAML = Psych # :nodoc:
|
||||||
|
|
||||||
module Psych # :nodoc:
|
module Psych # :nodoc:
|
||||||
# For compatibility, deprecated
|
# For compatibility, deprecated
|
||||||
|
|
|
@ -15,11 +15,13 @@ module YAML
|
||||||
#
|
#
|
||||||
# See the documentation for ::DBM and ::YAML for more information.
|
# See the documentation for ::DBM and ::YAML for more information.
|
||||||
class DBM < ::DBM
|
class DBM < ::DBM
|
||||||
VERSION = "0.1"
|
VERSION = "0.1" # :nodoc:
|
||||||
|
|
||||||
# Return value associated with +key+ from database.
|
# Return value associated with +key+ from database.
|
||||||
#
|
#
|
||||||
# Returns +nil+ if there is no such +key+.
|
# Returns +nil+ if there is no such +key+.
|
||||||
|
#
|
||||||
|
# See #fetch for more information.
|
||||||
def []( key )
|
def []( key )
|
||||||
fetch( key )
|
fetch( key )
|
||||||
end
|
end
|
||||||
|
@ -30,6 +32,8 @@ class DBM < ::DBM
|
||||||
# Set +key+ to +value+ in database.
|
# Set +key+ to +value+ in database.
|
||||||
#
|
#
|
||||||
# +value+ will be converted to YAML before storage.
|
# +value+ will be converted to YAML before storage.
|
||||||
|
#
|
||||||
|
# See #store for more information.
|
||||||
def []=( key, val )
|
def []=( key, val )
|
||||||
store( key, val )
|
store( key, val )
|
||||||
end
|
end
|
||||||
|
@ -43,6 +47,8 @@ class DBM < ::DBM
|
||||||
# If there is no value for +key+ and no block is given, returns +ifnone+.
|
# If there is no value for +key+ and no block is given, returns +ifnone+.
|
||||||
#
|
#
|
||||||
# Otherwise, calls block passing in the given +key+.
|
# Otherwise, calls block passing in the given +key+.
|
||||||
|
#
|
||||||
|
# See ::DBM#fetch for more information.
|
||||||
def fetch( keystr, ifnone = nil )
|
def fetch( keystr, ifnone = nil )
|
||||||
begin
|
begin
|
||||||
val = super( keystr )
|
val = super( keystr )
|
||||||
|
@ -67,6 +73,10 @@ class DBM < ::DBM
|
||||||
super( keystr.to_yaml )
|
super( keystr.to_yaml )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# :call-seq:
|
||||||
|
# db.key(value) -> string
|
||||||
|
#
|
||||||
|
# Returns the key for the specified value.
|
||||||
def key( keystr )
|
def key( keystr )
|
||||||
invert[keystr]
|
invert[keystr]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue