lib/rio/if/grande.rb in rio-0.4.0 vs lib/rio/if/grande.rb in rio-0.4.1
- old
+ new
@@ -113,11 +113,12 @@
# ario[*args]
# ario.entries(*args).to_a
#
# Arguments may consist of strings (treated as globs) or regular expressions.
# An empty argument list selects all entries
- # See ::Dir#glob and ::File::fnmatch? for more in information on _globs_. Be warned that using the '**' glob
+ # See ::Dir#glob and ::File::fnmatch? for more in information on _globs_.
+ # Be warned that using the '**' glob
# recurses into directories independently of IF::GrandeEntry#all and using both is unsupported.
#
# ario = rio('adir')
# ario[] # returns an array containg all entries in _adir_
# ario[/^zippy/] # all entries starting with 'zippy'
@@ -141,11 +142,12 @@
# === Lines
# This section applies similarly to IF::GrandeStream#lines, IF::GrandeStream#bytes,
# IF::GrandeStream#records, and IF::GrandeStream#rows
#
# Using IF::GrandeStream#lines and related methods with a Rio referencing a directory
- # imples IF::GrandeEntry#files and will cause an array of the lines or bytes in the files to be returned. As above,
+ # imples IF::GrandeEntry#files and will cause an array of the lines or bytes in the
+ # files to be returned. As above,
# the arguments to the subscript operator will be applied to the closest.
# rio('adir').lines[] # array of all lines in the files in 'adir'
# rio('adir').files.lines[] # same thing
# rio('adir').lines(0..9).files['*.txt'] # array of the first ten lines of all .txt files
# rio('adir').files('*.txt').lines[0..9] # same thing
@@ -217,11 +219,12 @@
# and call IF::Grande#each if one is given.
# So the existance of a block after many methods is taken as an implied
# IF::Grande#each
#
# For Rios that refer to files, the item passed to the block is a String containing
- # the line or block as selected by IF::GrandeStream#lines, or IF::GrandeStream#bytes. +lines+ is the default.
+ # the line or block as selected by IF::GrandeStream#lines, or IF::GrandeStream#bytes.
+ # +lines+ is the default.
# rio('afile').lines.each { |line| ...}
#
# The block passed to +each+ will also accept an optional second parameter which will contain
# the result of the matching function. What this variable contains depends on the argument
# to +lines+ that resulted in the match as follows:
@@ -378,11 +381,11 @@
#
# Make an ungizipped copy of a gzipped file
# rio('src.txt.gz').gzip > rio('dst.txt')
#
# Copying to an array
- # rio('afile') > ary # each line of the file becomes and element of the ary
+ # rio('afile') > ary # each line of the file becomes an element of the ary
# rio('afile').chomp > ary # same thing with lines chomped
# rio('afile.gz').gzip.chomp > ary # same thing from a gzipped file
#
# rio('afile').lines(0..9) > ary # ary will contain only the first ten lines of the file
# rio('afile').chomp.lines(0..9) > ary # same thing with lines chomped
@@ -404,11 +407,11 @@
# Copy lines of a web page into an array with each line chomped
# rio('http://ruby-doc.org/index.html').chomp > an_array
#
# Copy the first and 8th through 10th columns of the first ten rows of a gzipped csv
# file on a web site into a local gzipped csv file that uses semi-colons as separators
- # rio('http://domain/file.csv.gz').columns(0,7..9).gzip.csv[0..9] > rio('localfile.csv.gz').csv(';').gzip
+ # rio('http://host/file.csv.gz').columns(0,7..9).gzip.csv[0..9] > rio('localfile.csv.gz').csv(';').gzip
#
# See also IF::Grande#>>, IF::Grande#|
#
def >(destination)
RIO::no_warn {
@@ -519,14 +522,17 @@
# destination << entry
# end
# That is to say, it iterates through its argument, calling the copy-from operator
# again for each element. While it is not implemented like this, and the above code would
# not give the same results, This generalized description is convenient.
+ #
# For example the code:
- # dst < src
- # # is like
- # src.each { |line| dst << line }
+ #
+ # destination < source
+ # # is like
+ # source.each { |element| destination << element }
+ #
# for any of the following definitions of src and dst
# * copying files
# src = rio('afile')
# dst = rio('acopy')
# * copying parts of files
@@ -677,14 +683,14 @@
#
# The array returned is extended with a +to_rio+ method,
# which will put the parts back together again.
#
# ary = rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
- # ary.to_rio #=> rio('a/b/c')
+ # ary.to_rio #=> rio('a/b/c')
#
# ary = rio('a/b/c').split #=> [rio('a'),rio('b'),rio('c')]
# ary[1] = rio('d')
- # ary.to_rio #=> rio('a/d/c')
+ # ary.to_rio #=> rio('a/d/c')
#
# See also IF::Path#join, IF::Path#/, IF::Path#splitpath
#
# ==== split-with-an-argument:
#