Module: StrongPresenter::ControllerAdditions::ClassMethods
- Defined in:
- lib/strong_presenter/controller_additions.rb
Instance Method Summary collapse
-
#presents(*variables, options = {}) {|Presenter| ... } ⇒ Object
Defines a helper method to access instance variables wrapped in presenters.
Instance Method Details
#presents(*variables, options = {}) {|Presenter| ... } ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/strong_presenter/controller_additions.rb', line 35 def presents(*variables, &block) = variables. .assert_valid_keys(:with, :only, :except) constructor = StrongPresenter::PresenterHelperConstructor.new(self, block, ) variables.each do |variable| constructor.call(variable) helper_method variable end end |