Skip to content
Browse files

Use define_method instead of class eval to allow names with odd chara…

…cters.
  • Loading branch information...
1 parent ad0735a commit 42a50c9c153273b3a9876b8ab9381f450d8ca26c @josevalim josevalim committed
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/thor/rake_compat.rb
View
8 lib/thor/rake_compat.rb
@@ -43,11 +43,9 @@ def task(*args, &block)
description.strip!
klass.desc description, task.comment || non_namespaced_name
- klass.class_eval <<-METHOD
- def #{non_namespaced_name}(#{task.arg_names.join(', ')})
- Rake::Task[#{task.name.to_sym.inspect}].invoke(#{task.arg_names.join(', ')})
- end
- METHOD
+ klass.send :define_method, non_namespaced_name do |*args|
+ Rake::Task[task.name.to_sym].invoke(*args)
+ end
end
task

0 comments on commit 42a50c9

Please sign in to comment.
Something went wrong with that request. Please try again.