Class: DiscardReader

Inherits:
Object
  • Object
show all
Defined in:
lib/datalackeylib.rb

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ DiscardReader

Returns a new instance of DiscardReader.



615
616
617
618
619
620
621
622
623
624
625
626
627
# File 'lib/datalackeylib.rb', line 615

def initialize(input)
  @input = input
  return if input.nil?
  @reader = Thread.new do
    loop do
      @input.readpartial(32768)
    rescue IOError
      break # It is possible that close happens in another thread.
    rescue EOFError
      break
    end
  end
end

Instance Method Details

#closeObject



629
630
631
632
633
# File 'lib/datalackeylib.rb', line 629

def close
  return if @input.nil?
  @input.close
  @reader.join
end

#getlinesObject



635
636
637
# File 'lib/datalackeylib.rb', line 635

def getlines
  []
end