Module: CallChain

Defined in:
lib/active_record/connection_adapters/ibm_db_adapter.rb

Class Method Summary collapse

Class Method Details

.caller_method(depth = 1) ⇒ Object



21
22
23
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 21

def self.caller_method(depth = 1)
  parse_caller(caller(depth + 1).first).last
end

.parse_caller(at) ⇒ Object

Copied from ActionMailer



26
27
28
29
30
31
32
33
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 26

def self.parse_caller(at)
  return unless /^(.+?):(\d+)(?::in `(.*)')?/ =~ at

  file   = Regexp.last_match[1]
  line   = Regexp.last_match[2].to_i
  method = Regexp.last_match[3]
  [file, line, method]
end