Sha256: b9fe603bfa9b84fde57eadee04cd650c2d149cd02fb4c20ca5dde33283e9e172

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 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]
      fail AdapterNotRegisteredError.new(name: name) unless klass
      @registered_adapters[name]
    end

    # @private
    def reset!
      setup!
    end

    attr_reader :client

    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

2 entries across 2 versions & 1 rubygems

Version Path
yodeler-0.1.3 lib/yodeler.rb
yodeler-0.1.2 lib/yodeler.rb