Module: ActionWidget::ViewHelper

Defined in:
lib/action_widget/view_helper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/action_widget/view_helper.rb', line 3

def method_missing(name, *args, &block)
  widget = ActionWidget[name]
  return super if widget.nil?

  ActionWidget::ViewHelper.module_eval "    def \#{name}(*args, &block)               # def example_widget(*args, &block)\n      \#{widget}.render(self, *args, &block)  #   ExampleWidget.render(self, *args, &block)\n    end                                      # end\n  RUBY\n\n  send(name, *args, &block)\nend\n"

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/action_widget/view_helper.rb', line 16

def respond_to_missing?(name, include_private = false)
  !!ActionWidget[name] || super
end