Sha256: 861923c61f1e55008b49b746546f3e53f6a7a80728dd4fa0cafdec8fe0b7fb80

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require "yaml"
require 'forwardable'

require "yodeler/version"
require "yodeler/endpoint"
require "yodeler/client"
require "yodeler/metric"

require "yodeler/duplicate_endpoint_name_error"
require "yodeler/adapter_not_registered_error"

module Yodeler
  class << self
    extend Forwardable
    def_delegators :@client, :gauge, :increment, :timing, :publish

    #
    # @private
    def setup!
      @client = nil
      @registered_adapters = {}
    end

    def register_adapter(name,klass)
      @registered_adapters[name] = klass
    end

    #
    # @private
    def registered_adapters(name)
      klass = @registered_adapters[name]
      if !klass
        raise AdapterNotRegisteredError.new(name: name)
      end
      @registered_adapters[name]
    end

    # @private
    def reset!
      setup!
    end

    def client
      @client
    end

    def configure
      @client = Yodeler::Client.new
      yield @client
      @client
    end
  end
end

Yodeler.setup!
require "yodeler/adapters/memory_adapter"
require "yodeler/adapters/http_adapter"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yodeler-0.1.1 lib/yodeler.rb