Class IO::InputFilter
In: lib/ttk/Tools/io/filters.rb
Parent: DelegateClass(IO)

Methods

each   each_byte   each_line   getc   gets   new   read   readchar   readline   readlines  

Public Class methods

[Source]

# File lib/ttk/Tools/io/filters.rb, line 12
    def initialize(input, &block)
      @input = input
      @block = block
    end

Public Instance methods

[Source]

# File lib/ttk/Tools/io/filters.rb, line 16
    def each(&block)
      @input.each { |line| block[@block[line]] }
    end

[Source]

# File lib/ttk/Tools/io/filters.rb, line 19
    def each_byte(&block)
      @input.each_byte { |line| block[@block[line]] }
    end

[Source]

# File lib/ttk/Tools/io/filters.rb, line 22
    def each_line(&block)
      @input.each_line { |line| block[@block[line]] }
    end

[Source]

# File lib/ttk/Tools/io/filters.rb, line 25
    def getc
      @block[@input.getc]
    end

[Source]

# File lib/ttk/Tools/io/filters.rb, line 28
    def gets
      @block[@input.getc]
    end

[Source]

# File lib/ttk/Tools/io/filters.rb, line 31
    def read
      @block[@input.read]
    end
readchar()

Alias for getc

readline()

Alias for gets

[Source]

# File lib/ttk/Tools/io/filters.rb, line 34
    def readlines
      @input.readlines.map(&@block)
    end

[Validate]