Class: Metric

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/metrics/metric.rb,
lib/storage/metric_mongo.rb

Direct Known Subclasses

BooleanMetric, NumberMetric, StringMetric

Instance Method Summary collapse

Instance Method Details

#convert(value) ⇒ Object



20
21
22
# File 'lib/metrics/metric.rb', line 20

def convert value
  value
end

#edit(value, user) ⇒ Object



3
4
5
6
# File 'lib/metrics/metric.rb', line 3

def edit value, user
  values << PropertyValue.new(value: convert(value), created_by: user)
  self
end

#last_updated_atObject



16
17
18
# File 'lib/metrics/metric.rb', line 16

def last_updated_at
  values.last.try :created_at
end

#last_updated_byObject



12
13
14
# File 'lib/metrics/metric.rb', line 12

def last_updated_by
  values.last.try :created_by
end

#last_valueObject



8
9
10
# File 'lib/metrics/metric.rb', line 8

def last_value
  values.last.try :value
end