Module: RIO::Filter

Defined in:
lib/rio/filter.rb,
lib/rio/filter/gzip.rb,
lib/rio/filter/closeoneof.rb

Overview

:nodoc: all

Defined Under Namespace

Modules: CloseOnEOF, GZipMissing, GZipRead, GZipWin32MissingEachLine, GZipWrite

Class Method Summary collapse

Class Method Details

.make_line_filter(sym) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/rio/filter.rb', line 39

def self.make_line_filter(sym)
  module_eval %{
    module #{sym.to_s.capitalize}
     module IOE
      def gets(*args) super.__send__(:#{sym}) end
      def readline(*args) super.__send__(:#{sym}) end
      def each_line(*args,&block) super { |l| yield l.__send__(:#{sym}) } end
      def readlines(*args) super.map{|el| el.__send__(:#{sym})} end
     end
     include IOE
    end
  }
end