Skip to content

match Ruby 3.4 caller syntax '...' #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/core/facets/kernel/__dir__.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Kernel

def __DIR__(*paths)
c = caller.first
return nil unless c.rindex(/:\d+(:in `.*')?$/)
return nil unless c.rindex(/:\d+(:in [`'].*')?$/)
file = $` # File.dirname(c)
return nil if /\A\((.*)\)/ =~ file # eval, etc.
#File.expand_path(File.join(File.dirname(file), paths))
Expand Down
2 changes: 1 addition & 1 deletion lib/core/facets/kernel/callstack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def callstack(level = 1)
stack = []
call_str_array.each{ |call_str|
file, lineno, method = call_str.split(':')
if method =~ /in `(.*)'/ then
if method =~ /in [`'](.*)'/ then
method = $1.intern()
end
stack << [file, lineno.to_i, method]
Expand Down
4 changes: 2 additions & 2 deletions lib/core/facets/kernel/require_all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Kernel

def require_all(pattern)
c = caller.first
fail "Can't parse #{c}" unless c.rindex(/:\d+(:in `.*')?$/)
fail "Can't parse #{c}" unless c.rindex(/:\d+(:in [`'].*')?$/)
file = $` # File.dirname(c)
if /\A\((.*)\)/ =~ file # eval, etc.
raise LoadError, "require_relative is called in #{$1}"
Expand All @@ -27,7 +27,7 @@ def require_all(pattern)
# Same as #require_all, but for #load.
def load_all(pattern, safe=nil)
c = caller.first
fail "Can't parse #{c}" unless c.rindex(/:\d+(:in `.*')?$/)
fail "Can't parse #{c}" unless c.rindex(/:\d+(:in [`'].*')?$/)
file = $` # File.dirname(c)
if /\A\((.*)\)/ =~ file # eval, etc.
raise LoadError, "require_relative is called in #{$1}"
Expand Down