Method: SemanticLogger::Log#extract_file_and_line

Defined in:
lib/semantic_logger/log.rb

#extract_file_and_line(stack, short_name = false) ⇒ Object

Extract the filename and line number from the last entry in the supplied backtrace



251
252
253
254
255
256
257
258
# File 'lib/semantic_logger/log.rb', line 251

def extract_file_and_line(stack, short_name = false)
  return unless stack&.size&.positive?

  match = CALLER_REGEXP.match(stack.first)
  return unless match

  [short_name ? File.basename(match[1]) : match[1], match[2].to_i]
end