class Pipio::FileReader
Attributes
first_line[R]
other_lines[R]
Public Class Methods
new(path_to_file, cleaner)
click to toggle source
# File lib/pipio/file_reader.rb, line 3 def initialize(path_to_file, cleaner) @path_to_file = path_to_file @first_line = '' @other_lines = [] @cleaner = cleaner end
Public Instance Methods
read()
click to toggle source
# File lib/pipio/file_reader.rb, line 12 def read if File.exist?(@path_to_file) open(@path_to_file) do |file| @first_line = file.readline.strip @other_lines = file.readlines.map(&:strip) end clean_other_lines end end
Private Instance Methods
clean_other_lines()
click to toggle source
# File lib/pipio/file_reader.rb, line 25 def clean_other_lines @other_lines.map! { |line| @cleaner.clean(line) }.reject!(&:empty?) end