Class: TextReader
- Inherits:
-
Object
- Object
- TextReader
- Defined in:
- lib/io/text_reader.rb
Instance Attribute Summary collapse
-
#beginnings ⇒ Object
Returns the value of attribute beginnings.
-
#lines ⇒ Object
Returns the value of attribute lines.
Instance Method Summary collapse
-
#initialize(input_text_file) ⇒ TextReader
constructor
A new instance of TextReader.
- #process_input_text_file ⇒ Object
Constructor Details
#initialize(input_text_file) ⇒ TextReader
Returns a new instance of TextReader.
4 5 6 7 8 |
# File 'lib/io/text_reader.rb', line 4 def initialize(input_text_file) @input_text_file = input_text_file @beginnings = [] @lines = [] end |
Instance Attribute Details
#beginnings ⇒ Object
Returns the value of attribute beginnings.
2 3 4 |
# File 'lib/io/text_reader.rb', line 2 def beginnings @beginnings end |
#lines ⇒ Object
Returns the value of attribute lines.
2 3 4 |
# File 'lib/io/text_reader.rb', line 2 def lines @lines end |
Instance Method Details
#process_input_text_file ⇒ Object
10 11 12 13 14 |
# File 'lib/io/text_reader.rb', line 10 def process_input_text_file @lines = File.readlines(@input_text_file) @beginnings = @lines.collect { |s| s.split(' ').first }.reject { |w| w.nil? } return self end |