Class: PluckMap::Presenter
- Inherits:
-
Object
- Object
- PluckMap::Presenter
- Includes:
- CsvPresenter, HashPresenter, JsonPresenter
- Defined in:
- lib/pluck_map/presenter.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(model, attributes, query) ⇒ Presenter
constructor
A new instance of Presenter.
Methods included from CsvPresenter
Methods included from HashPresenter
Methods included from JsonPresenter
Constructor Details
#initialize(model, attributes, query) ⇒ Presenter
Returns a new instance of Presenter.
14 15 16 17 18 19 20 21 22 |
# File 'lib/pluck_map/presenter.rb', line 14 def initialize(model, attributes, query) unless query.model <= model raise ArgumentError, "Query for #{query.model} but #{model} expected" end @model = model @attributes = attributes @query = query end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
12 13 14 |
# File 'lib/pluck_map/presenter.rb', line 12 def attributes @attributes end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
12 13 14 |
# File 'lib/pluck_map/presenter.rb', line 12 def model @model end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
12 13 14 |
# File 'lib/pluck_map/presenter.rb', line 12 def query @query end |