Sha256: 2520a370367a9de6ea3221a3c3de645de50d5ee84763a953ac0588336dc31214
Contents?: true
Size: 606 Bytes
Versions: 2
Compression:
Stored size: 606 Bytes
Contents
module Pipio class FileReader def initialize(path_to_file, cleaner) @path_to_file = path_to_file @first_line = '' @other_lines = [] @cleaner = cleaner end attr_reader :first_line, :other_lines 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 def clean_other_lines @other_lines.map! { |line| @cleaner.clean(line) }.reject!(&:empty?) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pipio-0.0.2 | lib/pipio/file_reader.rb |
pipio-0.0.1 | lib/pipio/file_reader.rb |