class ModelObserver::Metric
Attributes
ended_at[RW]
model_class[RW]
model_id[RW]
started_at[RW]
Public Class Methods
new(model, started_at, ended_at)
click to toggle source
# File lib/model_observer/metric.rb, line 5 def initialize(model, started_at, ended_at) @model_class = model.class @model_id = model.__send__(model.class.primary_key) if model.class.primary_key @started_at = started_at @ended_at = ended_at end
Public Instance Methods
duration()
click to toggle source
# File lib/model_observer/metric.rb, line 12 def duration ((ended_at.to_f - started_at.to_f) * 1000).round(1) end