lib/rio/if/yaml.rb in rio-0.3.9 vs lib/rio/if/yaml.rb in rio-0.4.0
- old
+ new
@@ -48,18 +48,17 @@
# <tt>(skip)records</tt> is identical to <tt>(skip)lines</tt> because
# while +records+ only selects and does not specify the record-type,
# +lines+ is the default.
#
# The YAML extension distingishes between items selected using
- # IF::GrandeStream#records, IF::GrandeStream#rows and IF::GrandeStream#lines. Rio returns objects loaded via
- # YAML#load when +records+ is used; returns the YAML text as a String
- # when +rows+ is used; and returns lines as Strings as normal when
- # +lines+ is used. +records+ is the default. In yaml-mode,
- # <tt>(skip)records</tt> can be called as <tt>(skip)objects</tt> and
- # <tt>(skip)rows</tt> can be called as <tt>(skip)documents</tt>
+ # IF::GrandeStream#records, IF::GrandeStream#rows and IF::GrandeStream#lines.
+ # Rio returns objects loaded via
+ # YAML#load when +records+ or #objects is used; returns the YAML text as a String
+ # when +rows+ or #documents is used; and returns lines as Strings as normal when
+ # +lines+ is used. +records+ is the default.
#
- # To read a single YAML document, Rio provides #getobj and #load For
+ # To read a single YAML document, Rio provides #getobj and #load. For
# example, consider the following partial 'database.yml' from the rails
# distribution:
#
# development:
# adapter: mysql
@@ -91,16 +90,16 @@
# }
# }
# rio('afile.yaml').yaml.dump(anobject)
#
#
- # Single objects can be written using IF::Grande#putrec (aliased to IF::YAML#putobj
+ # Single objects can be written using IF::GrandeStream#putrec (aliased to IF::YAML#putobj
# and IF::YAML#dump)
#
# rio('afile.yaml').yaml.putobj(anobject)
#
- # Single objects can be loaded using IF::Grande#getrec (aliase to IF::Grande#getobj
+ # Single objects can be loaded using IF::GrandeStream#getrec (aliased to IF::YAML#getobj
# and IF::YAML#load)
#
# anobject = rio('afile.yaml').yaml.getobj
#
# A Rio in yaml-mode is just
@@ -141,31 +140,46 @@
# Select objects from a YAML file. See #yaml and RIO::Doc::INTRO
def objects(*selectors,&block) target.objects(*selectors,&block); self end
- # Reject objects from a YAML file. See #yaml and RIO::Doc::INTRO
+ # Reject objects from a YAML file. Calls IF::GrandeStream#skiprecords. See #yaml and RIO::Doc::INTRO
def skipobjects(*selectors,&block) target.skipobjects(*selectors,&block); self end
# Select documents from a YAML file. See #yaml and RIO::Doc::INTRO
def documents(*selectors,&block) target.documents(*selectors,&block); self end
- # Reject documents from a YAML file. Calls #skiprows. See #yaml and RIO::Doc::INTRO
+ # Reject documents from a YAML file. Calls IF::GrandeStream#skiprows. See #yaml and RIO::Doc::INTRO
def skipdocuments(*selectors,&block) target.skipdocuments(*selectors,&block); self end
+ # Select a single object. See #objects, IF::GrandeStream#line and #yaml.
+ def object(*args,&block) target.object(*args,&block); self end
+
+
+ # Select a single yaml document. See #documents, IF::GrandeStream#line and #yaml.
+ def document(*args,&block) target.document(*args,&block); self end
+
+
# Calls YAML.load.
#
# Loads a single YAML object from the stream referenced by the Rio
#
# rio('database.yml').yaml.getobj
#
# See #yaml and RIO::Doc::INTRO
#
def getobj() target.getobj() end
- # Alias for #getobj
+ # Calls YAML.load.
+ #
+ # Loads a single YAML object from the stream referenced by the Rio
+ #
+ # rio('database.yml').yaml.load
+ #
+ # See #yaml and RIO::Doc::INTRO
+ #
def load() target.load() end
# Alias for #getrec
#def getdoc() target.getdoc() end