Class: Snaptable::Constructor::BaseTable
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Snaptable::Constructor::BaseTable
show all
- Includes:
- Collection, Renderer, Sortable
- Defined in:
- lib/snaptable/constructor/base_table.rb
Instance Method Summary
collapse
Methods included from Renderer
#present, #respond
Methods included from Collection
#collection, #filter, #records
Methods included from Sortable
#css_class, #direction, #page, #sort_column, #sort_direction, #sortable
Constructor Details
#initialize(parent, collection = nil, options = {}) ⇒ BaseTable
Returns a new instance of BaseTable.
13
14
15
16
17
18
|
# File 'lib/snaptable/constructor/base_table.rb', line 13
def initialize(parent, collection = nil, options = {})
super(parent)
@collection = collection
@options = options
@token = stored_token if Snaptable.use_permission
end
|
Instance Method Details
#column_names ⇒ Object
24
25
26
|
# File 'lib/snaptable/constructor/base_table.rb', line 24
def column_names
model.column_names
end
|
#options ⇒ Object
20
21
22
|
# File 'lib/snaptable/constructor/base_table.rb', line 20
def options
@options
end
|
#url(e) ⇒ Object
28
29
30
|
# File 'lib/snaptable/constructor/base_table.rb', line 28
def url(e)
e.id
end
|
#values(element) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/snaptable/constructor/base_table.rb', line 32
def values(element)
attributes.map do |attribute|
if attribute.is_a? Symbol
element.send(attribute)
else
element.send(*attribute.keys).send(*attribute.values)
end.to_s
end
end
|