lib/rio/stream.rb in rio-0.3.7 vs lib/rio/stream.rb in rio-0.3.8

- old
+ new

@@ -1,8 +1,8 @@ #-- # =============================================================================== -# Copyright (c) 2005, Christopher Kleckner +# Copyright (c) 2005, 2006 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 @@ -20,11 +20,11 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # =============================================================================== #++ # # To create the documentation for Rio run the command -# rake rdoc +# ruby build_doc.rb # from the distribution directory. Then point your browser at the 'doc/rdoc' directory. # # Suggested Reading # * RIO::Doc::SYNOPSIS # * RIO::Doc::INTRO @@ -64,13 +64,10 @@ # Mixin the appropriate ops include Ops::Path::Str include Ops::Stream::Status include Ops::Stream::Manip -# def open(*args) -# softreset.open(*args) -# end def check?() open? end def when_missing(sym,*args) #p callstr('when_missing',sym,*args) retryreset() end @@ -85,10 +82,13 @@ def add_filter(mod) unless ioh.kind_of?(mod) ioh.extend(mod) end end +# def open_(*args) +# self +# end def rectype_mod case cx['stream_rectype'] when 'lines' then RIO::RecType::Lines when 'bytes' then RIO::RecType::Bytes else RIO::RecType::Lines @@ -108,28 +108,24 @@ end class Input < IOBase include Ops::Stream::Input include Ini include Filters - def initialize_copy(*args) - #p callstr('enter Input:initialize_copy',*args) - super - self.ioh.oncloseproc = proc { self.on_closeoneof } if closeoneof? - end def add_extensions() #p callstr('add_extensions') Ext::Input.add_extensions(self) end def add_filters add_filter(Filter::GZipRead) if gzip? #add_filter(Filter::YAML) if yaml? add_line_filters() - if closeoneof? - add_filter(Filter::CloseOnEOF) - ioh.oncloseproc = proc { self.on_closeoneof } - end +# add_filter(Filter::FasterCSV) if csv? +# if closeoneof? +# add_filter(Filter::CloseOnEOF) +# ioh.oncloseproc = proc { self.on_closeoneof } +# end self end def add_rec_methods() self.extend(rectype_mod.module_eval('Input')) end @@ -144,10 +140,11 @@ def add_extensions() Ext::Output.add_extensions(self) end def add_filters add_filter(Filter::GZipWrite) if gzip? + #add_filter(Filter::FasterCSV) if csv? #add_filter(Filter::YAML) if yaml? self end end @@ -156,15 +153,10 @@ include Ops::Stream::Input include Ops::Stream::Output include Ini include Filters - def initialize_copy(*args) - super - self.ioh.oncloseproc = proc { self.on_closeoneof } if closeoneof? - end - def add_rec_methods() self.extend(rectype_mod.module_eval('Input')) self.extend(rectype_mod.module_eval('Output')) end def add_extensions() @@ -173,13 +165,13 @@ end def add_filters add_line_filters() - if closeoneof? - add_filter(Filter::CloseOnEOF) - ioh.oncloseproc = proc { self.on_closeoneof } - end + # if closeoneof? + # add_filter(Filter::CloseOnEOF) + # ioh.oncloseproc = proc { self.on_closeoneof } + # end self end end end