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



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rio/filter.rb', line 29

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