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.
10 11 12 |
# File 'lib/cards/numbers_parser.rb', line 10 def initialize(file, table_name) @file, @table_name = file, table_name end |
Instance Method Details
#default_output_file ⇒ Object
30 31 32 |
# File 'lib/cards/numbers_parser.rb', line 30 def default_output_file @table_name end |
#each_unparsed_row ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cards/numbers_parser.rb', line 14 def each_unparsed_row numbers = Appscript.app('Numbers') document = numbers.open(@file) table = find_table(document, @table_name) table.rows.get.each do |row| values = [] row.cells.get.map do |cell| value = cell.value.get value = nil if value == 0 values << value end yield values end end |