R
rio4ruby
I am pleased to announce the first public release of Rio -- Rio 0.3.1
== Overview
Rio is a Ruby I/O convenience class wrapping much of the functionality
of IO, File and Dir. Rio also uses Pathname, FileUtils, Tempfile,
StringIO, OpenURI, Zlib, and CSV to provide similar functionality using
a simple consistent interface. In addition to forwarding the interfaces
provided by IO, File, and Dir to an appropriate object, Rio provides
a "grande" interface that allows many common application-level I/O and
file-system tasks to be expressed succinctly.
A Rio is and can manipulate:
* a path
* the string representing that path
* the file, directory, web-page, or IO object to which that path refers
* the object created by opening that file or directory.
A Rio open itself, closes itself and selects its mode based on how it
used and the object referenced.
== Grande interface
With the grande interface you can:
Copy...
rio('afile') > astring # a file into a string
rio('afile') < astring # a string into a file
rio('afile') > anarray # lines of a file into array
rio('afile') < anarray # an array into a file
rio('afile') > rio('another_file') # a file into another file
rio('adir') > rio('another_directory') # a directory into another
rio('http://rubydoc.org/') > rio('afile') # a web page into a file
Iterate...
rio('adir').entries { |entrio| ... } # over directory entries
rio('adir').files { |entrio| ... } # over only files
rio('adir').dirs { |entrio| ... } # over only directories
rio('afile').lines { |line| ... } # over lines in a file
Create an array...
rio('adir').files[] # of files
rio('adir').dirs[] # of directories
rio('afile').lines[] # of lines
Whether copying, iterating or returning an array
Rio provides common input manipulations
rio('afile').chomp > anarray # chomped lines to an array
anarray = rio('afile').chomp[] # same thing
rio('afile.gz').gzip > rio('afile') # ungzip a file
rio('afile.gz').gzip < rio('afile') # gzip a file
rio('afile.gz').chomp { |line| ...} # iterate chomped lines
Whether copying, iterating or returning an array
Rio provides simple input selection
rio('afile').lines(0..9) > rio('file2') # the first 10 lines
rio('afile').lines(/Rio/) { |line| ...} # lines containing 'Rio'
anarray = rio('adir').files['*.rb'] # ruby files
Manipulation and selection methods can be combined
rio('afile').gzip.lines(/Rio/) > astring # 'Rio' lines from gz file
anarray = rio('afile').chomp[0..9] # first 10 lines chomped
Many more examples and documentation at http://rio.rubyforge.org/
== Copyright
Copyright (c) 2005, Christopher Kleckner. All rights reserved
== License
Rio is released under the GNU General Public License
(http://www.gnu.org/licenses/gpl.html)
-Christopher Kleckner
== Overview
Rio is a Ruby I/O convenience class wrapping much of the functionality
of IO, File and Dir. Rio also uses Pathname, FileUtils, Tempfile,
StringIO, OpenURI, Zlib, and CSV to provide similar functionality using
a simple consistent interface. In addition to forwarding the interfaces
provided by IO, File, and Dir to an appropriate object, Rio provides
a "grande" interface that allows many common application-level I/O and
file-system tasks to be expressed succinctly.
A Rio is and can manipulate:
* a path
* the string representing that path
* the file, directory, web-page, or IO object to which that path refers
* the object created by opening that file or directory.
A Rio open itself, closes itself and selects its mode based on how it
used and the object referenced.
== Grande interface
With the grande interface you can:
Copy...
rio('afile') > astring # a file into a string
rio('afile') < astring # a string into a file
rio('afile') > anarray # lines of a file into array
rio('afile') < anarray # an array into a file
rio('afile') > rio('another_file') # a file into another file
rio('adir') > rio('another_directory') # a directory into another
rio('http://rubydoc.org/') > rio('afile') # a web page into a file
Iterate...
rio('adir').entries { |entrio| ... } # over directory entries
rio('adir').files { |entrio| ... } # over only files
rio('adir').dirs { |entrio| ... } # over only directories
rio('afile').lines { |line| ... } # over lines in a file
Create an array...
rio('adir').files[] # of files
rio('adir').dirs[] # of directories
rio('afile').lines[] # of lines
Whether copying, iterating or returning an array
Rio provides common input manipulations
rio('afile').chomp > anarray # chomped lines to an array
anarray = rio('afile').chomp[] # same thing
rio('afile.gz').gzip > rio('afile') # ungzip a file
rio('afile.gz').gzip < rio('afile') # gzip a file
rio('afile.gz').chomp { |line| ...} # iterate chomped lines
Whether copying, iterating or returning an array
Rio provides simple input selection
rio('afile').lines(0..9) > rio('file2') # the first 10 lines
rio('afile').lines(/Rio/) { |line| ...} # lines containing 'Rio'
anarray = rio('adir').files['*.rb'] # ruby files
Manipulation and selection methods can be combined
rio('afile').gzip.lines(/Rio/) > astring # 'Rio' lines from gz file
anarray = rio('afile').chomp[0..9] # first 10 lines chomped
Many more examples and documentation at http://rio.rubyforge.org/
== Copyright
Copyright (c) 2005, Christopher Kleckner. All rights reserved
== License
Rio is released under the GNU General Public License
(http://www.gnu.org/licenses/gpl.html)
-Christopher Kleckner