Module: ProcessMetrics::Timer

Defined in:
lib/process_metrics/timer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



52
53
54
# File 'lib/process_metrics/timer.rb', line 52

def self.included(base)
  base.extend ProcessMetrics::ClassMethods
end

Instance Method Details

#parent_uuid(options) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/process_metrics/timer.rb', line 56

def parent_uuid(options)
  return unless options

  if options[:parent_uuid].respond_to?(:call)
    # It's a proc. parent_uuid is the return value
    options[:parent_uuid].call
  elsif options[:parent_uuid].is_a?(Symbol)
    # It's a symbol. Call method on object and parent_uuid is its result.
    send(options[:parent_uuid])
  else
    # It's something static. Just call #to_s
    options[:parent_uuid].to_s
  end
end