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.



8
9
10
# File 'lib/qless/config.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/qless/config.rb', line 12

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

#[]=(key, value) ⇒ Object



16
17
18
# File 'lib/qless/config.rb', line 16

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

#allObject

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



22
23
24
# File 'lib/qless/config.rb', line 22

def all
  JSON.parse(@client.call('config.get'))
end

#clear(option) ⇒ Object

Restore this option to the default (remove this option)



27
28
29
# File 'lib/qless/config.rb', line 27

def clear(option)
  @client.call('config.unset', option)
end