Sha256: 14765318101354098b6bcf17ca1a7ae90eca9a1e593c62a125210ae3e2869229

Contents?: true

Size: 654 Bytes

Versions: 8

Compression:

Stored size: 654 Bytes

Contents

# Encoding: utf-8

require 'json'

module Qless
  # A configuration class associated with a qless 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 `qless` configuration option, or if
    # none is provided, get the complete current configuration
    def all
      JSON.parse(@client.call('config.get'))
    end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
qless-0.12.0 lib/qless/config.rb
qless-0.11.0 lib/qless/config.rb
qless-0.10.5 lib/qless/config.rb
qless-0.10.4 lib/qless/config.rb
qless-0.10.3 lib/qless/config.rb
qless-0.10.2 lib/qless/config.rb
qless-0.10.1 lib/qless/config.rb
qless-0.10.0 lib/qless/config.rb