1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Since Rails will require Ruby >= 1.8.7, we can rely on instance_exec.

This commit is contained in:
José Valim 2010-01-18 23:32:01 +01:00
parent e6a68a5cc3
commit e1029be1eb
2 changed files with 12 additions and 9 deletions

View file

@ -20,15 +20,15 @@ module Rails
directory 'tasks', plugin_dir('tasks') directory 'tasks', plugin_dir('tasks')
end end
hook_for :generator do |instance, generator| hook_for :generator do |generator|
instance.inside instance.send(:plugin_dir), :verbose => true do inside plugin_dir, :verbose => true do
instance.invoke generator, [ instance.name ], :namespace => false invoke generator, [ name ], :namespace => false
end end
end end
hook_for :test_framework do |instance, test_framework| hook_for :test_framework do |test_framework|
instance.inside instance.send(:plugin_dir), :verbose => true do inside plugin_dir, :verbose => true do
instance.invoke test_framework invoke test_framework
end end
end end

View file

@ -252,10 +252,13 @@ class Thor::Group
shell.padding += 1 shell.padding += 1
result = if block_given? result = if block_given?
if block.arity == 2 case block.arity
block.call(self, klass) when 3
else
block.call(self, klass, task) block.call(self, klass, task)
when 2
block.call(self, klass)
when 1
instance_exec(klass, &block)
end end
else else
invoke klass, task, *args invoke klass, task, *args