Sha256: 39e8d5e4a0fb5b35f2d2143c19a787a1cf5310f6cff706517236c6d2d71610fe

Contents?: true

Size: 928 Bytes

Versions: 24

Compression:

Stored size: 928 Bytes

Contents

class Remnant
  class Configuration
    # environment of application
    attr_reader :env

    # hostname to send to
    attr_reader :hostname

    # port to send to
    attr_reader :port_number

    # api key to use with payloads
    attr_reader :tag

    # how often to use results
    attr_reader :sample_rate

    # allow applications to run custom code with stats
    attr_reader :custom_hook

    def host(value)
      @hostname = value
    end

    def port(value)
      @port_number = value
    end

    def tagged(value)
      @tag = value
    end

    def environment(value)
      @env = value
    end

    def sample(value)
      @sample_rate = value
    end

    def hook(&block)
      @custom_hook = block
    end

    def defaults!
      # configure some defaults

      @hostname = '127.0.0.1'
      @port_number = 8125
      @tag = 'remnant'
      @sample_rate = 10

      self
    end # end defaults!
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
remnant-1.0.0 lib/remnant/configuration.rb
remnant-0.4.10 lib/remnant/configuration.rb
remnant-0.4.9 lib/remnant/configuration.rb
remnant-0.4.8 lib/remnant/configuration.rb
remnant-0.4.7 lib/remnant/configuration.rb
remnant-0.4.6 lib/remnant/configuration.rb
remnant-0.4.5 lib/remnant/configuration.rb
remnant-0.9.5 lib/remnant/configuration.rb
remnant-0.9.4 lib/remnant/configuration.rb
remnant-0.4.4 lib/remnant/configuration.rb
remnant-0.9.3 lib/remnant/configuration.rb
remnant-0.9.2 lib/remnant/configuration.rb
remnant-0.9.1 lib/remnant/configuration.rb
remnant-0.9.0 lib/remnant/configuration.rb
remnant-0.4.3 lib/remnant/configuration.rb
remnant-0.4.2 lib/remnant/configuration.rb
remnant-0.4.1 lib/remnant/configuration.rb
remnant-0.4.0 lib/remnant/configuration.rb
remnant-0.3.3 lib/remnant/configuration.rb
remnant-0.3.2 lib/remnant/configuration.rb