Class: TableList
- Inherits:
-
Object
- Object
- TableList
- Defined in:
- lib/table_list.rb
Instance Method Summary collapse
- #headers(columns = [], widths = {}) ⇒ Object
-
#initialize(instance) ⇒ TableList
constructor
A new instance of TableList.
- #sortable_headers(columns = [], widths = {}) ⇒ Object
- #td(data, options = {}) ⇒ Object
- #tr(&block) ⇒ Object
Constructor Details
#initialize(instance) ⇒ TableList
Returns a new instance of TableList.
2 3 4 |
# File 'lib/table_list.rb', line 2 def initialize(instance) @instance = instance end |
Instance Method Details
#headers(columns = [], widths = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/table_list.rb', line 12 def headers(columns=[], widths={}) @instance.content_tag :tr do @instance.concat(@instance.get_table_headers(columns, widths)) end end |
#sortable_headers(columns = [], widths = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/table_list.rb', line 6 def sortable_headers(columns=[], widths={}) @instance.content_tag :tr do @instance.concat(@instance.get_sortable_table_headers(columns, widths)) end end |
#td(data, options = {}) ⇒ Object
18 19 20 |
# File 'lib/table_list.rb', line 18 def td(data, ={}) @instance.content_tag :td, data.to_s.html_safe, :class => [:class]# unless options[:class].blank? end |
#tr(&block) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/table_list.rb', line 22 def tr(&block) raise "need a block" unless block_given? result = @instance.capture do @instance.content_tag :tr do block.call(self) end end end |