Class: Achoo::Achievo::Table
Instance Method Summary collapse
-
#initialize(source_rows) ⇒ Table
constructor
A new instance of Table.
- #select_columns(&block) ⇒ Object
Methods inherited from Array
Constructor Details
#initialize(source_rows) ⇒ Table
Returns a new instance of Table.
7 8 9 10 11 12 13 14 |
# File 'lib/achoo/achievo/table.rb', line 7 def initialize(source_rows) super() source_rows.each do |tr| cells = tr.css('td, th') cells = cells.collect {|c| c.content.strip} self << fix_empty_cells(cells) end end |
Instance Method Details
#select_columns(&block) ⇒ Object
16 17 18 19 20 |
# File 'lib/achoo/achievo/table.rb', line 16 def select_columns(&block) columns = transpose columns = columns.select &block replace(columns.transpose) end |