lib/rio/stream.rb in rio-0.5.1 vs lib/rio/stream.rb in rio-0.6.0
- old
+ new
@@ -1,8 +1,8 @@
#--
# ===========================================================================
-# Copyright (c) 2005-2012 Christopher Kleckner
+# Copyright (c) 2005-2017 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
@@ -36,30 +36,23 @@
require 'rio/ops/stream'
require 'rio/ops/stream/input'
require 'rio/ops/stream/output'
require 'rio/ext'
require 'rio/filter/gzip'
-#require 'rio/filter/yaml'
-#require 'rio/filter/chomp'
-#require 'rio/filter/strip'
-#require 'rio/filter/closeoneof'
module RIO
module Stream #:nodoc: all
class Reset < Base
# Mixin the appropriate ops
- #include Ops::Path::Str
include Ops::Stream::Reset
def check?() true end
def when_missing(sym,*args) retryreset() end
end
class IOBase < Base
-
-
# Mixin the appropriate ops
include Ops::Path::Str
include Ops::Stream::Status
include Ops::Stream::Manip
@@ -82,13 +75,10 @@
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
@@ -101,26 +91,23 @@
module Ini
def setup
super
@recno = -1
@get_selrej,@get_rangetops = create_selrej()
- # @cursor = io_enum
self
end
end
class Input < IOBase
include Ops::Stream::Input
include Ini
include Filters
-
def add_extensions()
#p callstr('add_extensions')
Ext::Input.add_extensions(self)
end
def add_filters
- #p "IN stream#add_filters"
if gzip?
gz = Zlib::GzipReader.new(self.ioh.ios)
gz.extend Filter::GZipMissing
gz.extend Filter::GZipWin32MissingEachLine
self.ioh.ios = gz
@@ -128,20 +115,12 @@
end
if csv?
require 'rio/ext/csv/filter' if $USE_FASTER_CSV
self.extend(::RIO::Ext::CSV::Input)
add_csv_filter() if $USE_FASTER_CSV
-# csvio = CSV.new(self.ioh.ios,*cx['csv_args'])
-# self.ioh.ios = csvio
end
- #add_filter(Filter::YAML) if yaml?
add_line_filters()
-# 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
@@ -165,15 +144,11 @@
end
if csv?
require 'rio/ext/csv/filter' if $USE_FASTER_CSV
self.extend(::RIO::Ext::CSV::Output)
add_csv_filter() if $USE_FASTER_CSV
-# csvio = CSV.new(self.ioh.ios,*cx['csv_args'])
-# self.ioh.ios = csvio
end
- #add_filter(Filter::FasterCSV) if csv?
- #add_filter(Filter::YAML) if yaml?
self
end
end
@@ -192,14 +167,9 @@
Ext::Output.add_extensions(self)
end
def add_filters
add_line_filters()
-
- # if closeoneof?
- # add_filter(Filter::CloseOnEOF)
- # ioh.oncloseproc = proc { self.on_closeoneof }
- # end
self
end
end
end