Sha256: 11a3cce564b10bbfca45d28572a1660cccd7afe1c063c201c51ea4dc6e9b20f1

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

require "qless/lua"
require "redis"
require "json"

module Qless
  # A configuration class associated with a qless client
  class Config
    def initialize(client)
      @client = client
    end
    
    def [](key)
      @client._config.call([], ['get', key])
    end
    
    def []=(key, value)
      @client._config.call([], ['set', key, value])
    end
    
    # Get the specified `qless` configuration option, or if
    # none is provided, get the complete current configuration
    def all
      return JSON.parse(@client._config.call([], ['get']))
    end
    
    # Restore this option to the default (remove this option)
    def clear(option)
      @client._config.call([], ['unset', option])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qless-0.9.2 lib/qless/config.rb
qless-0.9.1 lib/qless/config.rb