Class: Cards::NumbersParser
- Includes:
- TabularParser
- Defined in:
- lib/cards/numbers_parser.rb
Instance Method Summary collapse
- #default_output_file ⇒ Object
- #each_unparsed_row ⇒ Object
-
#initialize(file, table_name) ⇒ NumbersParser
constructor
A new instance of NumbersParser.
Methods included from TabularParser
#denormalized_rows, #each_row, #rows
Constructor Details
#initialize(file, table_name) ⇒ NumbersParser
Returns a new instance of NumbersParser.
8 9 10 |
# File 'lib/cards/numbers_parser.rb', line 8 def initialize(file, table_name) @file, @table_name = file, table_name end |
Instance Method Details
#default_output_file ⇒ Object
28 29 30 |
# File 'lib/cards/numbers_parser.rb', line 28 def default_output_file @table_name end |
#each_unparsed_row ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cards/numbers_parser.rb', line 12 def each_unparsed_row numbers = OSA.app('Numbers') document = numbers.open(@file) table = find_table(document, @table_name) table.rows.each do |row| values = [] row.cells.map do |cell| value = cell.value value = nil if value == 0 values << value end yield values end end |