action_widget 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
11
11
  gem.name = "action_widget"
12
12
  gem.require_paths = ["lib"]
13
- gem.version = "0.4.0"
13
+ gem.version = "0.5.0"
14
14
 
15
15
  gem.add_dependency 'smart_properties', '~> 1.1'
16
16
  end
@@ -5,17 +5,19 @@ module ActionWidget
5
5
  super unless name =~ /_widget$/
6
6
 
7
7
  klass = begin
8
- @_action_widget_class_cache = {}
9
- @_action_widget_class_cache[name] = "#{name.to_s.camelcase}".constantize
10
- rescue NameError => e
11
- super
12
- rescue LoadError => e
8
+ "#{name.to_s.camelcase}".constantize
9
+ rescue NameError, LoadError
13
10
  super
14
11
  end
15
12
 
16
- klass.new(self, *args).render(&block)
13
+ ActionWidget::ViewHelper.module_eval <<-RUBY
14
+ def #{name}(*args, &block) # def example_widget(*args, &block)
15
+ #{klass}.new(self, *args).render(&block) # ExampleWidget.new(self, *args).render(&block)
16
+ end # end
17
+ RUBY
18
+
19
+ send(name, *args, &block)
17
20
  end
18
21
 
19
22
  end
20
23
  end
21
-
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: action_widget
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.0
5
+ version: 0.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Konstantin Tennhard
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-04 00:00:00.000000000 Z
12
+ date: 2012-12-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  version_requirements: !ruby/object:Gem::Requirement