Class: Resque::UniqueInQueue::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/resque/unique_in_queue/configuration.rb

Constant Summary collapse

DEFAULT_LOCK_AFTER_EXECUTION_PERIOD =
0
DEFAULT_TTL =
-1
DEFAULT_UNIQUE_IN_QUEUE_KEY_BASE =
"r-uiq".freeze
DEFAULT_LOG_LEVEL =
:debug

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/resque/unique_in_queue/configuration.rb', line 20

def initialize
  debug_mode_from_env
  @lock_after_execution_period = DEFAULT_LOCK_AFTER_EXECUTION_PERIOD
  @log_level = DEFAULT_LOG_LEVEL
  @logger = nil
  @ttl = DEFAULT_TTL
  @unique_in_queue_key_base = DEFAULT_UNIQUE_IN_QUEUE_KEY_BASE
  if @debug_mode
    # Make sure there is a logger when in debug_mode
    @logger ||= Logger.new($stdout)
  end
end

Instance Attribute Details

#debug_modeObject

Returns the value of attribute debug_mode.



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

def debug_mode
  @debug_mode
end

#lock_after_execution_periodObject

Returns the value of attribute lock_after_execution_period.



14
15
16
# File 'lib/resque/unique_in_queue/configuration.rb', line 14

def lock_after_execution_period
  @lock_after_execution_period
end

#log_levelObject

Returns the value of attribute log_level.



14
15
16
# File 'lib/resque/unique_in_queue/configuration.rb', line 14

def log_level
  @log_level
end

#loggerObject

Returns the value of attribute logger.



14
15
16
# File 'lib/resque/unique_in_queue/configuration.rb', line 14

def logger
  @logger
end

#ttlObject

Returns the value of attribute ttl.



14
15
16
# File 'lib/resque/unique_in_queue/configuration.rb', line 14

def ttl
  @ttl
end

#unique_in_queue_key_baseObject

Returns the value of attribute unique_in_queue_key_base.



14
15
16
# File 'lib/resque/unique_in_queue/configuration.rb', line 14

def unique_in_queue_key_base
  @unique_in_queue_key_base
end

Instance Method Details

#to_hashObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/resque/unique_in_queue/configuration.rb', line 33

def to_hash
  {
    debug_mode: debug_mode,
    lock_after_execution_period: lock_after_execution_period,
    log_level: log_level,
    logger: logger,
    ttl: ttl,
    unique_in_queue_key_base: unique_in_queue_key_base
  }
end