Module: EasyTable::ViewExt::Row::Data
- Defined in:
- lib/easy-table/row/data.rb
Instance Method Summary collapse
- #attribute_cells(object, attributes, options = {}) ⇒ Object
- #data_row(object, attributes, options = {}) ⇒ Object
- #data_rows(collection, attributes, options = {}) ⇒ Object
Instance Method Details
#attribute_cells(object, attributes, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/easy-table/row/data.rb', line 23 def attribute_cells object, attributes, = {} .delete(:row_classes) content = [] reset_cycle('cells') attributes.each do |attrib| cls_opt = class_option(:cell_classes, , :name => 'cells') content << cell(object, attrib, .merge(cls_opt)) content << ''.indent(2) if attrib == attributes.last end content.join.html_safe end |
#data_row(object, attributes, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/easy-table/row/data.rb', line 13 def data_row object, attributes, ={} row_content = attribute_cells object, attributes, .clone cls_opt = class_option(:row_classes, , :name => 'rows') [:row] ||= {} [:row].merge!(cls_opt) indent_tag(2, :tr, row_content, [:row]).html_safe end |
#data_rows(collection, attributes, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/easy-table/row/data.rb', line 3 def data_rows collection, attributes, = {} content = [] reset_cycle('rows') collection.each do |obj| row_content = data_row(obj, attributes, ) content << indent(2) + row_content end content.join.html_safe end |