Module: Fortitude::Widget::Integration
- Extended by:
- ActiveSupport::Concern
- Included in:
- Fortitude::Widget
- Defined in:
- lib/fortitude/widget/integration.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #_fortitude_target_method_and_args_for_method_missing(missing_method_name, *missing_method_args, &missing_method_block) ⇒ Object
-
#method_missing(name, *args, &block) ⇒ Object
RUBY CALLBACK.
- #respond_to?(name, include_all = false) ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
RUBY CALLBACK
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fortitude/widget/integration.rb', line 35 def method_missing(name, *args, &block) target_method_and_args = _fortitude_target_method_and_args_for_method_missing(name, *args, &block) if target_method_and_args target = target_method_and_args[0] method = target_method_and_args[1] args = target_method_and_args[2..-1] target.send(method, *args, &block) else super(name, *args, &block) end end |
Instance Method Details
#_fortitude_target_method_and_args_for_method_missing(missing_method_name, *missing_method_args, &missing_method_block) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/fortitude/widget/integration.rb', line 59 def _fortitude_target_method_and_args_for_method_missing(missing_method_name, *missing_method_args, &missing_method_block) if self.class.extra_assigns == :use && missing_method_args.length == 0 && (! missing_method_block) ivar_name = self.class.instance_variable_name_for_need(missing_method_name) return [ self, :instance_variable_get, ivar_name ] if instance_variable_defined?(ivar_name) end if self.class.automatic_helper_access && @_fortitude_rendering_context && @_fortitude_rendering_context.helpers_object && @_fortitude_rendering_context.helpers_object.respond_to?(missing_method_name, true) return [ @_fortitude_rendering_context.helpers_object, missing_method_name, *missing_method_args ] end if @_fortitude_in_block_for_sub_widget return [ @_fortitude_in_block_for_sub_widget, missing_method_name, *missing_method_args ] end nil end |
#respond_to?(name, include_all = false) ⇒ Boolean
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fortitude/widget/integration.rb', line 48 def respond_to?(name, include_all = false) out = super(name, include_all) if (! out) target_method_and_args = _fortitude_target_method_and_args_for_method_missing(name) out = true if target_method_and_args end out end |