Deprecatable::Util

Common utility functions used by all the Deprecatable modules and classes

Public Class Methods

location_of_caller() click to toggle source

Find the caller of the method that called the method where location_of_call was invoked.

Example:

def foo
  bar()  # <--- this file and line number is returned
end

def bar
  Deprecatable::Util.location_of_caller
end

Return the [ file, line number] tuple from which bar() was invoked.

# File lib/deprecatable/util.rb, line 18
def self.location_of_caller
  call_line     = caller[1]
  file, line, _ = call_line.split(':')
  file          = File.expand_path( file )
  line          = Float(line).to_i
  return file, line
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.