Class: MetricsCapacitor::Model::Metrics

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/metrics-capacitor/model/metrics.rb

Instance Method Summary collapse

Constructor Details

#initialize(data = []) ⇒ Metrics

Returns a new instance of Metrics.



8
9
10
# File 'lib/metrics-capacitor/model/metrics.rb', line 8

def initialize(data = [])
  @metrics = data.map { |m| Metric.new(m) }
end

Instance Method Details

#proc_by_slices!(n) ⇒ Object



12
13
14
# File 'lib/metrics-capacitor/model/metrics.rb', line 12

def proc_by_slices!(n)
  @metrics.each_slice(n) { |s| yield Metrics.new(s) }
end

#to_elasticObject



16
17
18
# File 'lib/metrics-capacitor/model/metrics.rb', line 16

def to_elastic
  @metrics.map(&:to_elastic)
end

#to_redisObject



20
21
22
# File 'lib/metrics-capacitor/model/metrics.rb', line 20

def to_redis
  @metrics.map(&:to_redis)
end