Commit 713dbb6
committed
Use correct line numbers for
🌈 When using heredoc, the line number that is passed to `eval` method should be a `__LINE__ + 1`.
For example
```ruby
instance_eval <<-END, __FILE__, __LINE__
raise 'In the instance_eval'
END
```
It print below.
```bash
$ ruby test.rb
test.rb:1:in `<main>': In the instance_eval (RuntimeError)
from test.rb:1:in `instance_eval'
from test.rb:1:in `<main>'
```
It says "This exception occurred on the 1st line", but the `raise` is on the 2nd line.
This change will fix this problem.class_eval and module_eval methods1 parent 0e2615f commit 713dbb6
2 files changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
0 commit comments