Class: FnordMetric::Context

Inherits:
Object
  • Object
show all
Includes:
GaugeModifiers
Defined in:
lib/fnordmetric/context.rb

Instance Method Summary collapse

Methods included from GaugeModifiers

#incr, #incr_field, #incr_tick, #incr_uniq

Constructor Details

#initialize(opts, block) ⇒ Context

Returns a new instance of Context.



5
6
7
8
# File 'lib/fnordmetric/context.rb', line 5

def initialize(opts, block)
  @block = block
  @opts = opts    
end

Instance Method Details

#call(event, redis) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/fnordmetric/context.rb', line 10

def call(event, redis)
  @redis = redis
  @event = event    
  self.instance_eval(&@block)
rescue Exception => e
  raise e  if ENV['FNORDMETRIC_ENV'] == 'test'
  puts "error: #{e.message}"
end