Sha256: 79bd32362c726fff4a14d7076e78e844110a1cb407a7471328d9c02a090267dc
Contents?: true
Size: 708 Bytes
Versions: 2
Compression:
Stored size: 708 Bytes
Contents
module ActionWidget module ViewHelper 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) attrs = args.last.kind_of?(Hash) ? args.pop : {} #{widget}.new(self, attrs).render(*args, &block) # ExampleWidget.new(self, attrs).render(*args, &block) end # end RUBY send(name, *args, &block) end def respond_to_missing?(name, include_private = false) !!ActionWidget[name] || super end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
action_widget-0.6.1 | lib/action_widget/view_helper.rb |
action_widget-0.6.0 | lib/action_widget/view_helper.rb |