Skip to content

Commit b544b76

Browse files
authored
Merge pull request #589 from pocke/correct-lineno
Use correct line numbers for `class_eval` and `module_eval` methods
2 parents dd45079 + 713dbb6 commit b544b76

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/thor/group.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def invoke(*names, &block)
6161
invocations[name] = false
6262
invocation_blocks[name] = block if block_given?
6363

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

123-
class_eval <<-METHOD, __FILE__, __LINE__
123+
class_eval <<-METHOD, __FILE__, __LINE__ + 1
124124
def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')}
125125
return unless options[#{name.inspect}]
126126

lib/thor/shell.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def shell
5555

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

0 commit comments

Comments
 (0)