Sha256: 5584fe266c799cf565b65ed22a5bec74736d4980c5fb24e9e6a057374d67abcc

Contents?: true

Size: 663 Bytes

Versions: 5

Compression:

Stored size: 663 Bytes

Contents

# Encoding: utf-8

require 'json'

module Reqless
  # A configuration class associated with a reqless client
  class Config
    def initialize(client)
      @client = client
    end

    def [](key)
      @client.call('config.get', key)
    end

    def []=(key, value)
      @client.call('config.set', key, value)
    end

    # Get the specified `reqless` configuration option, or if
    # none is provided, get the complete current configuration
    def all
      JSON.parse(@client.call('config.getAll'))
    end

    # Restore this option to the default (remove this option)
    def clear(option)
      @client.call('config.unset', option)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reqless-0.0.5 lib/reqless/config.rb
reqless-0.0.4 lib/reqless/config.rb
reqless-0.0.3 lib/reqless/config.rb
reqless-0.0.2 lib/reqless/config.rb
reqless-0.0.1 lib/reqless/config.rb