Skip to content

Commit

Permalink
Merge pull request #589 from pocke/correct-lineno
Browse files Browse the repository at this point in the history
Use correct line numbers for `class_eval` and `module_eval` methods
  • Loading branch information
rafaelfranca committed Sep 11, 2018
2 parents dd45079 + 713dbb6 commit b544b76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/thor/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def invoke(*names, &block)
invocations[name] = false
invocation_blocks[name] = block if block_given?

class_eval <<-METHOD, __FILE__, __LINE__
class_eval <<-METHOD, __FILE__, __LINE__ + 1
def _invoke_#{name.to_s.gsub(/\W/, '_')}
klass, command = self.class.prepare_for_invocation(nil, #{name.inspect})
Expand Down Expand Up @@ -120,7 +120,7 @@ def invoke_from_option(*names, &block)
invocations[name] = true
invocation_blocks[name] = block if block_given?

class_eval <<-METHOD, __FILE__, __LINE__
class_eval <<-METHOD, __FILE__, __LINE__ + 1
def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')}
return unless options[#{name.inspect}]
Expand Down
2 changes: 1 addition & 1 deletion lib/thor/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def shell

# Common methods that are delegated to the shell.
SHELL_DELEGATED_METHODS.each do |method|
module_eval <<-METHOD, __FILE__, __LINE__
module_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{method}(*args,&block)
shell.#{method}(*args,&block)
end
Expand Down

0 comments on commit b544b76

Please sign in to comment.