-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
https://stackoverflow.com/questions/19507477/how-to-get-current-file-and-line-number-in-ruby
note: this was awesome!
caller vs caller_locations(1, 1) vs __LINE__
Print line number where "Function [is] Called" instead of "Function Definition".
caller_locations(1, 1) standard post Ruby 2.0
caller if pre Ruby 2.0
Why caller_locations(1,1)? Its much faster than caller(), source: https://stackoverflow.com/questions/5100299/how-to-get-the-name-of-the-calling-method
https://stackoverflow.com/questions/224379/what-does-file-mean-in-ruby
Q. What does FILE mean in Ruby?
A. It is a reference to the current file name
http://blog.honeybadger.io/data-and-end-in-ruby/
note: a good read
nice: http://ruby-doc.org/docs/keywords/1.9/Object.html#method-i-__LINE__
note: the above link was also useful for a note in external repo: #1
Reason: "defined?"
Metadata
Metadata
Assignees
Labels
No labels