Class: Cyrax::Presenters::DecoratedCollection
- Inherits:
-
BaseCollection
- Object
- BaseCollection
- Cyrax::Presenters::DecoratedCollection
- Defined in:
- lib/cyrax/presenters/decorated_collection.rb
Instance Attribute Summary
Attributes inherited from BaseCollection
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(collection, options = {}) ⇒ DecoratedCollection
constructor
A new instance of DecoratedCollection.
- #presented_collection ⇒ Object
Methods inherited from BaseCollection
Constructor Details
#initialize(collection, options = {}) ⇒ DecoratedCollection
Returns a new instance of DecoratedCollection.
3 4 5 6 7 8 |
# File 'lib/cyrax/presenters/decorated_collection.rb', line 3 def initialize(collection, = {}) super unless [:decorator] raise "Decorator is not defined! Please define it with option :decorator" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Cyrax::Presenters::BaseCollection
Class Method Details
.decorate(*args) ⇒ Object
14 15 16 |
# File 'lib/cyrax/presenters/decorated_collection.rb', line 14 def self.decorate(*args) new(*args).presented_collection end |
Instance Method Details
#presented_collection ⇒ Object
10 11 12 |
# File 'lib/cyrax/presenters/decorated_collection.rb', line 10 def presented_collection @decorated_collection ||= super.map {|item| decorate_item(item)} end |