Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/duck_punches/array/each_with_presenter.rb
Instance Method Summary collapse
-
#each_with_presenter(presenter_class, object_name, presenter_options = {}, &block) ⇒ Object
Wrap each element in the Array with a presenter specified by @presenter_class@ and assigned as the model for @object_name@.
Instance Method Details
#each_with_presenter(presenter_class, object_name, presenter_options = {}, &block) ⇒ Object
Wrap each element in the Array with a presenter specified by @presenter_class@ and assigned as the model for @object_name@. @presenter_options@ are set once on the initial presenter instance.
6 7 8 9 10 11 12 |
# File 'lib/duck_punches/array/each_with_presenter.rb', line 6 def each_with_presenter(presenter_class, object_name, ={}, &block) presenter = presenter_class.new() each do |object| presenter.send("#{object_name}=", object) yield presenter end end |