Module: EasyTable::ViewExt::Cell
- Includes:
- Util
- Defined in:
- lib/easy-table/cell.rb
Instance Method Summary
collapse
Methods included from Util
#class_option, #cycle_class, #get_class
Instance Method Details
#cell(object, attribute, options = {}) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/easy-table/cell.rb', line 27
def cell object, attribute, options = {}
options.delete(:classes)
options.delete(:cell_classes)
options.delete(:row_classes)
options.delete(:row)
value = object.send(attribute) || "Unknown attribute: #{attribute}"
indent_tag(3, :td, value, options).html_safe
end
|
#cells(object, attributes, options = {}) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/easy-table/cell.rb', line 15
def cells object, attributes, options = {}
content = []
reset_cycle('cells')
attributes.each_with_index do |attrib, index|
cls_opt = class_option(:classes, options, :name => 'cells')
content << cell(object, attrib, options.merge(cls_opt))
content << ''.indent(2) if attrib == attributes.last
end
content.join.html_safe
end
|
6
7
8
9
10
11
12
13
|
# File 'lib/easy-table/cell.rb', line 6
def heads
content = []
heads.each do |head|
content << indent_tag(3, :th, head)
content << ''.indent(2) if head == heads.last
end
content.join.html_safe
end
|