Class: Metrics::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/metrics/handler.rb

Overview

Internal: Responsible for taking a list or an Array of Metrics::Instrumenters and passing them to the formatter.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*instrumenters) ⇒ Handler

Returns a new instance of Handler.



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

def initialize(*instrumenters)
  @instrumenters = instrumenters.flatten
end

Instance Attribute Details

#instrumentersObject (readonly)

Returns the value of attribute instrumenters.



6
7
8
# File 'lib/metrics/handler.rb', line 6

def instrumenters
  @instrumenters
end

Class Method Details

.handle(*instrumenters) ⇒ Object



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

def self.handle(*instrumenters)
  new(*instrumenters).handle
end

Instance Method Details

#handleObject

Public: Writes all of the instrumenters to STDOUT using the formatter.

Returns an Array of Metrics::Instrumenters that were written to STDOUT.



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

def handle
  write instrumenters
  result
end