Skip to content

Commit

Permalink
Since Rails will require Ruby >= 1.8.7, we can rely on instance_exec.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 19, 2010
1 parent e6a68a5 commit e1029be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
12 changes: 6 additions & 6 deletions railties/lib/generators/rails/plugin/plugin_generator.rb
Expand Up @@ -20,15 +20,15 @@ def create_tasks_files
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

Expand Down
9 changes: 6 additions & 3 deletions railties/lib/rails/vendor/thor-0.12.3/lib/thor/group.rb
Expand Up @@ -252,10 +252,13 @@ def _invoke_for_class_method(klass, task=nil, *args, &block) #:nodoc:
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
Expand Down

0 comments on commit e1029be

Please sign in to comment.