Sha256: 74840b8e0604bcd3faed90dd02f43705498f6a669b4f9e78e9e91261e1c5db5c

Contents?: true

Size: 440 Bytes

Versions: 1

Compression:

Stored size: 440 Bytes

Contents

class IO
  #Returns array of lines up until the given string matches a line of the file.
  def self.read_until(file,string)
    f = self.readlines(file)
    i = f.index(string) || 100000
    f.slice(0,i)
  end
  
  #from output_catcher gem
  def self.capture_stdout(&block)
    original_stdout = $stdout
    $stdout = fake = StringIO.new
    begin
      yield
    ensure
      $stdout = original_stdout
    end
    fake.string
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cldwalker-core-0.0.0 lib/core/io.rb