Class: DiningTable::Table
- Inherits:
-
Object
- Object
- DiningTable::Table
- Defined in:
- lib/dining-table/table.rb
Instance Attribute Summary collapse
-
#action_columns ⇒ Object
Returns the value of attribute action_columns.
-
#collection ⇒ Object
Returns the value of attribute collection.
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#index ⇒ Object
Returns the value of attribute index.
-
#options ⇒ Object
Returns the value of attribute options.
-
#presenter ⇒ Object
Returns the value of attribute presenter.
-
#view_context ⇒ Object
Returns the value of attribute view_context.
Instance Method Summary collapse
- #define ⇒ Object
- #helpers ⇒ Object (also: #h)
-
#initialize(collection, view_context, options = {}) ⇒ Table
constructor
A new instance of Table.
- #render ⇒ Object
Constructor Details
#initialize(collection, view_context, options = {}) ⇒ Table
Returns a new instance of Table.
7 8 9 10 11 12 13 14 15 |
# File 'lib/dining-table/table.rb', line 7 def initialize( collection, view_context, = {} ) self.collection = collection self.view_context = view_context self.index = 0 self.columns = [ ] self. = initialize_presenter( ) define end |
Instance Attribute Details
#action_columns ⇒ Object
Returns the value of attribute action_columns.
5 6 7 |
# File 'lib/dining-table/table.rb', line 5 def action_columns @action_columns end |
#collection ⇒ Object
Returns the value of attribute collection.
5 6 7 |
# File 'lib/dining-table/table.rb', line 5 def collection @collection end |
#columns ⇒ Object
Returns the value of attribute columns.
5 6 7 |
# File 'lib/dining-table/table.rb', line 5 def columns @columns end |
#index ⇒ Object
Returns the value of attribute index.
5 6 7 |
# File 'lib/dining-table/table.rb', line 5 def index @index end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/dining-table/table.rb', line 5 def end |
#presenter ⇒ Object
Returns the value of attribute presenter.
5 6 7 |
# File 'lib/dining-table/table.rb', line 5 def presenter @presenter end |
#view_context ⇒ Object
Returns the value of attribute view_context.
5 6 7 |
# File 'lib/dining-table/table.rb', line 5 def view_context @view_context end |
Instance Method Details
#define ⇒ Object
17 18 19 |
# File 'lib/dining-table/table.rb', line 17 def define raise NotImplementedError end |
#helpers ⇒ Object Also known as: h
35 36 37 |
# File 'lib/dining-table/table.rb', line 35 def helpers view_context end |
#render ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dining-table/table.rb', line 21 def render presenter.start_table presenter.render_header unless no_header presenter.start_body collection.each_with_index do |object, index_| self.index = index_ presenter.render_row( object ) end presenter.end_body presenter. presenter.end_table presenter.output end |