Class: Qless::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/qless/config.rb

Overview

A configuration class associated with a qless client

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Config

Returns a new instance of Config.



6
7
8
# File 'lib/qless/config.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#[](key) ⇒ Object



10
11
12
# File 'lib/qless/config.rb', line 10

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

#[]=(key, value) ⇒ Object



14
15
16
# File 'lib/qless/config.rb', line 14

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

#allObject

Get the specified ‘qless` configuration option, or if none is provided, get the complete current configuration



20
21
22
# File 'lib/qless/config.rb', line 20

def all
  return JSON.parse(@client._config.call([], ['get']))
end

#clear(option) ⇒ Object

Restore this option to the default (remove this option)



25
26
27
# File 'lib/qless/config.rb', line 25

def clear(option)
  @client._config.call([], ['unset', option])
end