Skip to content

Commit f3ac648

Browse files
authored
Merge pull request #308 from paddor/main
match Ruby 3.4 caller syntax '...'
2 parents efee9a3 + 31250f5 commit f3ac648

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/core/facets/kernel/__dir__.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Kernel
99

1010
def __DIR__(*paths)
1111
c = caller.first
12-
return nil unless c.rindex(/:\d+(:in `.*')?$/)
12+
return nil unless c.rindex(/:\d+(:in [`'].*')?$/)
1313
file = $` # File.dirname(c)
1414
return nil if /\A\((.*)\)/ =~ file # eval, etc.
1515
#File.expand_path(File.join(File.dirname(file), paths))

lib/core/facets/kernel/callstack.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def callstack(level = 1)
3131
stack = []
3232
call_str_array.each{ |call_str|
3333
file, lineno, method = call_str.split(':')
34-
if method =~ /in `(.*)'/ then
34+
if method =~ /in [`'](.*)'/ then
3535
method = $1.intern()
3636
end
3737
stack << [file, lineno.to_i, method]

lib/core/facets/kernel/require_all.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Kernel
1313

1414
def require_all(pattern)
1515
c = caller.first
16-
fail "Can't parse #{c}" unless c.rindex(/:\d+(:in `.*')?$/)
16+
fail "Can't parse #{c}" unless c.rindex(/:\d+(:in [`'].*')?$/)
1717
file = $` # File.dirname(c)
1818
if /\A\((.*)\)/ =~ file # eval, etc.
1919
raise LoadError, "require_relative is called in #{$1}"
@@ -27,7 +27,7 @@ def require_all(pattern)
2727
# Same as #require_all, but for #load.
2828
def load_all(pattern, safe=nil)
2929
c = caller.first
30-
fail "Can't parse #{c}" unless c.rindex(/:\d+(:in `.*')?$/)
30+
fail "Can't parse #{c}" unless c.rindex(/:\d+(:in [`'].*')?$/)
3131
file = $` # File.dirname(c)
3232
if /\A\((.*)\)/ =~ file # eval, etc.
3333
raise LoadError, "require_relative is called in #{$1}"

0 commit comments

Comments
 (0)