-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
require 'pp'
module A
def method_from_a
caller
end
end
class C
include A
def method_from_c
__send__(:method_from_a)
end
end
pp C.new.method_from_c
The code above if run under MRI Ruby 1.9.3 or 2.0, the output is:
["X:/ene/RubyScripts/1development/debug_caller/caller.rb:12:in `method_from_c'",
"X:/ene/RubyScripts/1development/debug_caller/caller.rb:16:in `<top (required)>'",
"-e:1:in `load'",
"-e:1:in `<main>'"]
If the code above is running under JRuby 1.7.3, the output is:
["X:/ene/RubyScripts/1development/debug_caller/caller.rb:12:in `__send__'",
"X:/ene/RubyScripts/1development/debug_caller/caller.rb:12:in `method_from_c'",
"X:/ene/RubyScripts/1development/debug_caller/caller.rb:16:in `(root)'",
"-e:1:in `load'",
"-e:1:in `(root)'"]
The output from MRI Ruby and JRuby are obviously different.
I could add some additional logic to my code using something like RUBY_PLATFORM to find the immediate caller, but isn't a compatibility issue for JRUBY?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels