Sha256: cc1bfdd30b824f37f698c63388348d6fb461bff0ba02773f5793d03ccb8d98b0

Contents?: true

Size: 561 Bytes

Versions: 4

Compression:

Stored size: 561 Bytes

Contents

module HeimdallApm
  class Config
    def initialize
      @loaded = nil
      load_default_config
    end

    def value(key)
      # TODO: handle empty strings keys or boolean passed as strings
      @loaded && @settings[key]
    end
    alias_method :[], :value

    def has_key?(key)
      @settings.key?(key)
    end
    alias_method :key?, :has_key?

    private

    def load_default_config
      @settings = Rails.application.config_for(:heimdall_apm)
      @loaded   = true
    rescue
      # TODO: handle no configuration file found
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
heimdall_apm-0.1.3 lib/heimdall_apm/config.rb
heimdall_apm-0.1.2 lib/heimdall_apm/config.rb
heimdall_apm-0.1.1 lib/heimdall_apm/config.rb
heimdall_apm-0.1.0 lib/heimdall_apm/config.rb