J
J
Jeket2014-07-09 01:10:54
ruby
Jeket, 2014-07-09 01:10:54

How to find out which class called the method of another class?

How to find out in ruby ​​which class called the method of another class from the called class?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zuzzz, 2014-07-09
@zuzzz

I'm not familiar with the ruby ​​language, but I think the calling class can be found from the stack trace
begin
here specifically raise an exception
rescue Exception => e
puts e.backtrace
end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question