Class: Jetmeter::FlowReducer

Inherits:
Object
  • Object
show all
Defined in:
lib/jetmeter/flow_reducer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_collections, config) ⇒ FlowReducer

Returns a new instance of FlowReducer.



5
6
7
8
9
10
11
# File 'lib/jetmeter/flow_reducer.rb', line 5

def initialize(resource_collections, config)
  @resource_collections = resource_collections
  @config_flows = config.flows
  @flows = Hash.new do |hash, flow_name|
    hash[flow_name] = Hash.new { |flow, date| flow[date] = [] }
  end
end

Instance Attribute Details

#flowsObject (readonly)

Returns the value of attribute flows.



3
4
5
# File 'lib/jetmeter/flow_reducer.rb', line 3

def flows
  @flows
end

Instance Method Details

#reduce(accumulators, filters) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/jetmeter/flow_reducer.rb', line 13

def reduce(accumulators, filters)
  @resource_collections.each do |resource_collection|
    resource_collection.each do |resource|
      reduce_resource(resource, accumulators, filters)
    end
  end
end