Class: Compendium::Presenters::Settings::Table
- Defined in:
- app/classes/compendium/presenters/settings/table.rb
Instance Attribute Summary collapse
-
#headings ⇒ Object
readonly
Returns the value of attribute headings.
Instance Method Summary collapse
- #format(column, &block) ⇒ Object
- #formatters ⇒ Object
-
#initialize(headings) ⇒ Table
constructor
A new instance of Table.
- #override_heading(col, label) ⇒ Object
Methods inherited from Query
Constructor Details
#initialize(headings) ⇒ Table
Returns a new instance of Table.
5 6 7 8 |
# File 'app/classes/compendium/presenters/settings/table.rb', line 5 def initialize(headings) super() @headings = Hash[headings.zip(headings)].with_indifferent_access end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Compendium::Presenters::Settings::Query
Instance Attribute Details
#headings ⇒ Object (readonly)
Returns the value of attribute headings.
3 4 5 |
# File 'app/classes/compendium/presenters/settings/table.rb', line 3 def headings @headings end |
Instance Method Details
#format(column, &block) ⇒ Object
14 15 16 17 |
# File 'app/classes/compendium/presenters/settings/table.rb', line 14 def format(column, &block) @settings[:formatters] ||= {} @settings[:formatters][column] = block end |
#formatters ⇒ Object
19 20 21 |
# File 'app/classes/compendium/presenters/settings/table.rb', line 19 def formatters (@settings[:formatters] || {}) end |
#override_heading(col, label) ⇒ Object
10 11 12 |
# File 'app/classes/compendium/presenters/settings/table.rb', line 10 def override_heading(col, label) @headings[col] = label end |