Class: Apfel::Reader

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

Overview

Class for reading in files and returning an array of its content

Class Method Summary collapse

Class Method Details

.read(file) ⇒ Object

Reads in a file and returns an array consisting of each line of input cleaned of new line characters



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/apfel/reader.rb', line 6

def self.read(file)
  File.open(file, "r") do |f|
  content_array=[]
  content = f.read
    content.each_line do |line|
      line.gsub!("\n","")
      content_array.push(line)
    end
    content_array
  end
end