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')
end
hook_for :generator do |instance, generator|
instance.inside instance.send(:plugin_dir), :verbose => true do
instance.invoke generator, [ instance.name ], :namespace => false
hook_for :generator do |generator|
inside plugin_dir, :verbose => true do
invoke generator, [ name ], :namespace => false
end
end
hook_for :test_framework do |instance, test_framework|
instance.inside instance.send(:plugin_dir), :verbose => true do
instance.invoke test_framework
hook_for :test_framework do |test_framework|
inside plugin_dir, :verbose => true do
invoke test_framework
end
end

View file

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