Class: TotalIn::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/total_in/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Parser

Parser.new accepts a File instance or a String A InvalidFileFormatError will be raised if file isn’t in the TotalIn format



13
14
15
16
# File 'lib/total_in/parser.rb', line 13

def initialize file
  @file = file
  validate_file_format
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



9
10
11
# File 'lib/total_in/parser.rb', line 9

def file
  @file
end

Instance Method Details

#resultObject



18
19
20
# File 'lib/total_in/parser.rb', line 18

def result
  parse_lines(Contexts.new).result
end