Sha256: c63dc34f390c9794ac64cf8de873b70fd1e8be99e4eca3e559e16824ca3fd411

Contents?: true

Size: 450 Bytes

Versions: 4

Compression:

Stored size: 450 Bytes

Contents

module ActionWidget
  module ViewHelper
    
    def method_missing(name, *args, &block)
      super unless name =~ /_widget$/
    
      klass = begin
       @_action_widget_class_cache       = {}
       @_action_widget_class_cache[name] = "#{name.to_s.camelcase}".constantize
      rescue NameError => e
        super
      rescue LoadError => e
        super
      end
    
      klass.new(*args).render_in_context(self, &block)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
action_widget-0.3.2 lib/action_widget/view_helper.rb
action_widget-0.3.1 lib/action_widget/view_helper.rb
action_widget-0.3.0 lib/action_widget/view_helper.rb
action_widget-0.2.0 lib/action_widget/view_helper.rb