lib/rio/if/yaml.rb in rio-0.4.2 vs lib/rio/if/yaml.rb in rio-0.5.1

- old
+ new

@@ -1,8 +1,8 @@ #-- -# =============================================================================== -# Copyright (c) 2005,2006,2007,2008 Christopher Kleckner +# =========================================================================== +# Copyright (c) 2005-2012 Christopher Kleckner # All rights reserved # # This file is part of the Rio library for ruby. # # Rio is free software; you can redistribute it and/or modify @@ -16,26 +16,13 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Rio; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# =============================================================================== +# =========================================================================== #++ # -# To create the documentation for Rio run the command -# ruby build_doc.rb -# from the distribution directory. -# -# Suggested Reading -# * RIO::Doc::SYNOPSIS -# * RIO::Doc::INTRO -# * RIO::Doc::HOWTO -# * RIO::Doc::EXAMPLES -# * RIO::Rio -# - - module RIO module IF module YAML #def file() target.file end #def dir() target.dir end @@ -48,11 +35,11 @@ # <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. + # {#records}[rdoc-ref:IF::GrandeStream#records], {#rows}[rdoc-ref:IF::GrandeStream#rows] and {#lines}[rdoc-ref: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. # @@ -90,24 +77,24 @@ # } # } # rio('afile.yaml').yaml.dump(anobject) # # - # Single objects can be written using IF::GrandeStream#putrec (aliased to IF::YAML#putobj - # and IF::YAML#dump) + # Single objects can be written using {#putrec}[rdoc-ref:IF::GrandeStream#putrec] (aliased to {#putobj}[rdoc-ref:IF::YAML#putobj] + # and {#dump}[rdoc-ref:IF::YAML#dump]) # # rio('afile.yaml').yaml.putobj(anobject) # - # Single objects can be loaded using IF::GrandeStream#getrec (aliased to IF::YAML#getobj - # and IF::YAML#load) + # Single objects can be loaded using {#getrec}[rdoc-ref:IF::GrandeStream#getrec] (aliased to {#getobj}[rdoc-ref:IF::YAML#getobj] + # and {#load}[rdoc-ref:IF::YAML#load]) # # anobject = rio('afile.yaml').yaml.getobj # # A Rio in yaml-mode is just # like any other Rio. And all the things you can do with any Rio come - # for free. They can be iterated over using IF::Grande#each and read into an - # array using IF::Grande#[] just like any other Rio. All the selection criteria + # for free. They can be iterated over using {#each}[rdoc-ref:IF::Grande#each] and read into an + # array using {#[]}[link:RIO/IF/Grande.html#method-i-5B-5D] just like any other Rio. All the selection criteria # are identical also. # # Get the first three objects into an array: # # array_of_objects = rio('afile.yaml').yaml[0..2] @@ -140,26 +127,26 @@ # 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. Calls IF::GrandeStream#skiprecords. See #yaml and RIO::Doc::INTRO + # Reject objects from a YAML file. Calls {#skiprecords}[rdoc-ref: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 IF::GrandeStream#skiprows. See #yaml and RIO::Doc::INTRO + # Reject documents from a YAML file. Calls {#skiprows}[rdoc-ref: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. + # Select a single object. See #objects, {#line}[rdoc-ref: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. + # Select a single yaml document. See #documents, {#line}[rdoc-ref:IF::GrandeStream#line] and #yaml. def document(*args,&block) target.document(*args,&block); self end # Calls YAML.load. # @@ -186,20 +173,20 @@ # Calls YAML.dump, leaving the Rio open. def putobj(obj) target.putobj(obj); self end - # Dumps an object to a Rio as with IF::YAML#putobj, and closes the Rio. + # Dumps an object to a Rio as with {#putobj}[rdoc-ref:IF::YAML#putobj], and closes the Rio. # # rio('afile.yaml').yaml.putobj!(anobject) # # is identical to # # rio('afile.yaml').yaml.putobj(anobject).close # def putobj!(obj) target.putobj!(obj); self end - # Alias for IF::YAML#putobj! + # Alias for {#putobj!}[rdoc-ref:IF::YAML#putobj!] def dump(obj) target.dump(obj); self end end end end