Class: IO

Inherits:
Object show all
Defined in:
lib/core/io.rb

Class Method Summary collapse

Class Method Details

.read_until(file, string) ⇒ Object

Returns array of lines up until the given string matches a line of the file.



3
4
5
6
7
# File 'lib/core/io.rb', line 3

def self.read_until(file,string)
  f = self.readlines(file)
  i = f.index(string) || 100000
  f.slice(0,i)
end