Module: ProcessMetrics::Timer

Defined in:
lib/process_metrics/timer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



72
73
74
# File 'lib/process_metrics/timer.rb', line 72

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

Instance Method Details

#parent_uuid(options) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/process_metrics/timer.rb', line 76

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(self)
  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