Sha256: 5714f4708d81be5898681d8c8365c168c2003057292d3070f5b866ea5221c003
Contents?: true
Size: 429 Bytes
Versions: 1
Compression:
Stored size: 429 Bytes
Contents
module ModelObserver class Metric attr_accessor :model_class, :model_id, :started_at, :ended_at 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 def duration ((ended_at.to_f - started_at.to_f) * 1000).round(1) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
model_observer-0.4.0 | lib/model_observer/metric.rb |