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 <<-RUBY
def #{name}(*args, &block) # def example_widget(*args, &block)
#{widget}.render(self, *args, &block) # ExampleWidget.render(self, *args, &block)
end # end
RUBY
send(name, *args, &block)
end
|
Instance Method Details
#respond_to_missing?(name, include_private = false) ⇒ 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
|