Class: Trestle::Table
- Inherits:
-
Object
show all
- Defined in:
- lib/trestle/table.rb,
lib/trestle/table/row.rb,
lib/trestle/table/column.rb,
lib/trestle/table/builder.rb,
lib/trestle/table/automatic.rb,
lib/trestle/table/select_column.rb,
lib/trestle/table/actions_column.rb
Defined Under Namespace
Classes: ActionsColumn, Automatic, Builder, Column, Renderer, Row, SelectColumn
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Table
Returns a new instance of Table.
14
15
16
17
|
# File 'lib/trestle/table.rb', line 14
def initialize(options={})
@options = options
@columns = []
end
|
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
10
11
12
|
# File 'lib/trestle/table.rb', line 10
def columns
@columns
end
|
#options ⇒ Object
Returns the value of attribute options.
12
13
14
|
# File 'lib/trestle/table.rb', line 12
def options
@options
end
|
#row ⇒ Object
45
46
47
|
# File 'lib/trestle/table.rb', line 45
def row
@row || Row.new
end
|
Instance Method Details
#admin ⇒ Object
25
26
27
|
# File 'lib/trestle/table.rb', line 25
def admin
Trestle.lookup(options[:admin]) if options.key?(:admin)
end
|
#autolink? ⇒ Boolean
33
34
35
|
# File 'lib/trestle/table.rb', line 33
def autolink?
options[:autolink] != false
end
|
37
38
39
|
# File 'lib/trestle/table.rb', line 37
def
options[:header] != false
end
|
#renderer(template) ⇒ Object
41
42
43
|
# File 'lib/trestle/table.rb', line 41
def renderer(template)
Renderer.new(self, template)
end
|
#sortable? ⇒ Boolean
29
30
31
|
# File 'lib/trestle/table.rb', line 29
def sortable?
options[:sortable] == true
end
|
#with_options(opts = {}) ⇒ Object
19
20
21
22
23
|
# File 'lib/trestle/table.rb', line 19
def with_options(opts={})
dup.tap do |table|
table.options = options.merge(opts)
end
end
|