Class: Feint::Presenter
- Inherits:
-
Object
- Object
- Feint::Presenter
- Defined in:
- lib/feint/presenter.rb
Class Method Summary collapse
-
.attributes(*columns) ⇒ Object
Takes a list of columns.
-
.transform(mappings) ⇒ Object
Take a list of mappiings { old_column_name => new_column_name }.
Instance Method Summary collapse
-
#initialize(model) ⇒ Presenter
constructor
:nodoc:.
Constructor Details
#initialize(model) ⇒ Presenter
:nodoc:
3 4 5 |
# File 'lib/feint/presenter.rb', line 3 def initialize(model) # :nodoc: @model = model end |
Class Method Details
.attributes(*columns) ⇒ Object
Takes a list of columns
9 10 11 12 13 14 15 |
# File 'lib/feint/presenter.rb', line 9 def attributes(*columns) columns.each do |column| define_method column do @model.send(column) end end end |
.transform(mappings) ⇒ Object
Take a list of mappiings { old_column_name => new_column_name }
19 20 21 22 23 24 25 |
# File 'lib/feint/presenter.rb', line 19 def transform(mappings) mappings.each do |old, new| define_method new do @model.send(old) end end end |