Class: Dashboards::Table
- Inherits:
-
Object
- Object
- Dashboards::Table
- Defined in:
- lib/dashboards/dsl/table.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(name_or_options, options = {}) ⇒ Table
constructor
A new instance of Table.
- #render(context) ⇒ Object
Constructor Details
#initialize(name_or_options, options = {}) ⇒ Table
Returns a new instance of Table.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/dashboards/dsl/table.rb', line 7 def initialize(, = {}) if .is_a?(Hash) @name = nil = else @name = end @data = [:data] || [:value] @options = .except(:data, :value) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/dashboards/dsl/table.rb', line 5 def data @data end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/dashboards/dsl/table.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/dashboards/dsl/table.rb', line 5 def @options end |
Instance Method Details
#render(context) ⇒ Object
18 19 20 21 |
# File 'lib/dashboards/dsl/table.rb', line 18 def render(context) data = @data.is_a?(Proc) ? context.instance_exec(&@data) : @data render_table(data) end |