Class: Compendium::Presenters::Settings::Table

Inherits:
Query
  • Object
show all
Defined in:
app/classes/compendium/presenters/settings/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Query

#method_missing

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

#headingsObject (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

#formattersObject



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