Class: Nerve::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/nerve/reporter.rb,
lib/nerve/reporter/base.rb,
lib/nerve/reporter/zookeeper.rb

Defined Under Namespace

Classes: Base, Zookeeper

Class Method Summary collapse

Class Method Details

.new_from_service(service) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/nerve/reporter.rb', line 4

def self.new_from_service(service)
  type = service['reporter_type'] || 'zookeeper'
  reporter = begin
    require "nerve/reporter/#{type.downcase}"
    self.const_get(type.downcase.capitalize)
  rescue Exception => e
    raise ArgumentError, "specified a reporter_type of #{type}, which could not be found: #{e}"
  end
  reporter.new(service)
end