Class: Lacquer::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/lacquer/configuration.rb

Constant Summary collapse

OPTIONS =
[ :varnish_servers ]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



23
24
25
26
27
28
29
30
# File 'lib/lacquer/configuration.rb', line 23

def initialize
  @enable_cache = true
  @varnish_servers = []
  @default_ttl = 0
  @job_backend = :none
  @retries = 5
  @command_error_handler = nil
end

Instance Attribute Details

#command_error_handlerObject

Error handler



21
22
23
# File 'lib/lacquer/configuration.rb', line 21

def command_error_handler
  @command_error_handler
end

#default_ttlObject

Application default ttl



12
13
14
# File 'lib/lacquer/configuration.rb', line 12

def default_ttl
  @default_ttl
end

#enable_cacheObject

Enable cache



6
7
8
# File 'lib/lacquer/configuration.rb', line 6

def enable_cache
  @enable_cache
end

#job_backendObject

Job Backend



18
19
20
# File 'lib/lacquer/configuration.rb', line 18

def job_backend
  @job_backend
end

#retriesObject

Application default ttl



15
16
17
# File 'lib/lacquer/configuration.rb', line 15

def retries
  @retries
end

#varnish_serversObject

Varnish servers



9
10
11
# File 'lib/lacquer/configuration.rb', line 9

def varnish_servers
  @varnish_servers
end

Instance Method Details

#to_hashObject

Returns a hash of all configurable options



33
34
35
36
37
# File 'lib/lacquer/configuration.rb', line 33

def to_hash
  OPTIONS.inject({}) do |hash, option|
    hash.merge(option.to_sym => send(option))
  end
end