Module: YiffSpace::Utils::Helpers
- Defined in:
- lib/yiffspace/utils/helpers.rb
Class Method Summary collapse
-
.method_missing(name) ⇒ Object
Uses send/respond_to?(name, true) (not public_send/respond_to?(name)) because host apps commonly call helpers through this proxy with an explicit receiver (e.g. a decorator's
h.some_helper), including ones marked private in their helper module - private only restricts calling with an explicit receiver, and normal view rendering (which invokes helpers without one) isn't affected either way. - .respond_to_missing?(name, include_private = false) ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object (private)
Uses send/respond_to?(name, true) (not public_send/respond_to?(name)) because host apps
commonly call helpers through this proxy with an explicit receiver (e.g. a decorator's
h.some_helper), including ones marked private in their helper module - private only
restricts calling with an explicit receiver, and normal view rendering (which invokes
helpers without one) isn't affected either way.
13 14 15 16 17 18 |
# File 'lib/yiffspace/utils/helpers.rb', line 13 def method_missing(name, *, &) helpers = YiffSpace.config.application_controller_class.helpers return helpers.send(name, *, &) if helpers.respond_to?(name, true) super end |
Class Method Details
.method_missing(name) ⇒ Object
Uses send/respond_to?(name, true) (not public_send/respond_to?(name)) because host apps
commonly call helpers through this proxy with an explicit receiver (e.g. a decorator's
h.some_helper), including ones marked private in their helper module - private only
restricts calling with an explicit receiver, and normal view rendering (which invokes
helpers without one) isn't affected either way.
13 14 15 16 17 18 |
# File 'lib/yiffspace/utils/helpers.rb', line 13 def method_missing(name, *, &) helpers = YiffSpace.config.application_controller_class.helpers return helpers.send(name, *, &) if helpers.respond_to?(name, true) super end |