Class: PartialPathCustomizer::Presenter
- Inherits:
-
DumbDelegator
- Object
- DumbDelegator
- PartialPathCustomizer::Presenter
- Defined in:
- lib/partial_path_customizer/presenter.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(object, &partial_path_block) ⇒ Presenter
constructor
A new instance of Presenter.
- #to_model ⇒ Object
- #to_partial_path ⇒ Object
Constructor Details
#initialize(object, &partial_path_block) ⇒ Presenter
Returns a new instance of Presenter.
11 12 13 14 |
# File 'lib/partial_path_customizer/presenter.rb', line 11 def initialize(object, &partial_path_block) super(object) @partial_path_block = partial_path_block end |
Class Method Details
.wrap_collection(collection, &partial_path_block) ⇒ Object
5 6 7 8 9 |
# File 'lib/partial_path_customizer/presenter.rb', line 5 def self.wrap_collection collection, &partial_path_block collection.map do |obj| new obj, &partial_path_block end end |
Instance Method Details
#to_model ⇒ Object
24 25 26 |
# File 'lib/partial_path_customizer/presenter.rb', line 24 def to_model self end |
#to_partial_path ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/partial_path_customizer/presenter.rb', line 16 def to_partial_path if @partial_path_block.present? @partial_path_block.call(_model) else __getobj__.to_partial_path end end |