Module: Vapir::TableRow
- Extended by:
- ElementHelper
- Defined in:
- lib/vapir-common/elements/elements.rb
Instance Method Summary collapse
-
#[](index) ⇒ Object
returns the TableCell at the specified index.
-
#cell_at_colum(index) ⇒ Object
returns the cell of the current row at the given column index (starting from 1), taking into account conSpans of other cells.
- #cell_count ⇒ Object
- #column_count ⇒ Object
-
#each_cell ⇒ Object
(also: #each)
Iterate over each cell in the row.
Methods included from ElementHelper
add_specifier, container_collection_method, container_single_method, included
Methods included from ElementClassAndModuleMethods
#add_container_method_extra_args, #all_dom_attr_aliases, #all_dom_attrs, #class_array_append, #class_array_get, #class_hash_get, #class_hash_merge, #container_collection_methods, #container_method_extra_args, #container_single_methods, #default_how, #dom_attr, #dom_attr_locate_alias, #dom_function, #dom_setter, #element_collection, #factory, #inspect_these, #inspect_this_if, #parent_element_module, #set_or_get_class_var, #specifiers
Instance Method Details
#[](index) ⇒ Object
returns the TableCell at the specified index
653 654 655 |
# File 'lib/vapir-common/elements/elements.rb', line 653 def [](index) cells[index] end |
#cell_at_colum(index) ⇒ Object
returns the cell of the current row at the given column index (starting from 1), taking into account conSpans of other cells.
returns nil if index is greater than the number of columns of this row.
670 671 672 673 674 675 |
# File 'lib/vapir-common/elements/elements.rb', line 670 def cell_at_colum(index) cells.detect do |cell| index=index-(cell.colSpan || 1) index <= 0 end end |
#cell_count ⇒ Object
662 663 664 |
# File 'lib/vapir-common/elements/elements.rb', line 662 def cell_count cells.length end |
#column_count ⇒ Object
657 658 659 660 661 |
# File 'lib/vapir-common/elements/elements.rb', line 657 def column_count cells.inject(0) do |count, cell| count+ (cell.colSpan || 1) end end |
#each_cell ⇒ Object Also known as: each
Iterate over each cell in the row.
645 646 647 648 649 |
# File 'lib/vapir-common/elements/elements.rb', line 645 def each_cell cells.each do |cell| yield cell end end |