Class: BravoPresenter::Collection
- Inherits:
-
Object
- Object
- BravoPresenter::Collection
- Includes:
- Enumerable
- Defined in:
- lib/bravo_presenter/collection.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
Returns the value of attribute collection.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#each(&block) ⇒ Object
nodoc.
-
#empty? ⇒ Boolean
nodoc.
-
#initialize(collection, template) ⇒ Collection
constructor
nodoc.
Constructor Details
#initialize(collection, template) ⇒ Collection
nodoc
9 10 11 12 |
# File 'lib/bravo_presenter/collection.rb', line 9 def initialize(collection, template) self.collection = collection self.template = template end |
Instance Attribute Details
#collection ⇒ Object
Returns the value of attribute collection.
3 4 5 |
# File 'lib/bravo_presenter/collection.rb', line 3 def collection @collection end |
#template ⇒ Object
Returns the value of attribute template.
3 4 5 |
# File 'lib/bravo_presenter/collection.rb', line 3 def template @template end |
Instance Method Details
#each(&block) ⇒ Object
nodoc
16 17 18 19 20 |
# File 'lib/bravo_presenter/collection.rb', line 16 def each(&block) collection.each do |obj| block.call template.present_object(obj) end end |
#empty? ⇒ Boolean
nodoc
24 25 26 |
# File 'lib/bravo_presenter/collection.rb', line 24 def empty? count == 0 end |