Sha256: a74e5262b04a8c04b652356a8d58f2d686aa658451ba03f48f3de25ebbd70ea5
Contents?: true
Size: 610 Bytes
Versions: 1
Compression:
Stored size: 610 Bytes
Contents
module ActionWidget module ViewHelper def method_missing(name, *args, &block) super unless name =~ /_widget$/ klass = begin "#{name.to_s.camelcase}".constantize rescue NameError, LoadError super end ActionWidget::ViewHelper.module_eval <<-RUBY def #{name}(*args, &block) # def example_widget(*args, &block) #{klass}.new(self, *args).render(&block) # ExampleWidget.new(self, *args).render(&block) end # end RUBY send(name, *args, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
action_widget-0.5.0 | lib/action_widget/view_helper.rb |