Class: Resque::UniqueAtRuntime::Configuration

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

Constant Summary collapse

DEFAULT_LOCK_TIMEOUT =
60 * 60 * 24 * 5
DEFAULT_REQUEUE_INTERVAL =
1
DEFAULT_UNIQUE_AT_RUNTIME_KEY_BASE =
'r-uar'.freeze
DEFAULT_LOG_LEVEL =
:debug

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



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

def initialize
  debug_mode_from_env
  @lock_timeout = DEFAULT_LOCK_TIMEOUT
  @log_level = DEFAULT_LOG_LEVEL
  @logger = nil
  @requeue_interval = DEFAULT_REQUEUE_INTERVAL
  @unique_at_runtime_key_base = DEFAULT_UNIQUE_AT_RUNTIME_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.



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

def debug_mode
  @debug_mode
end

#lock_timeoutObject

Returns the value of attribute lock_timeout.



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

def lock_timeout
  @lock_timeout
end

#log_levelObject

Returns the value of attribute log_level.



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

def log_level
  @log_level
end

#loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

#requeue_intervalObject

Returns the value of attribute requeue_interval.



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

def requeue_interval
  @requeue_interval
end

#unique_at_runtime_key_baseObject

Returns the value of attribute unique_at_runtime_key_base.



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

def unique_at_runtime_key_base
  @unique_at_runtime_key_base
end

Instance Method Details

#to_hashObject



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

def to_hash
  {
    debug_mode: debug_mode,
    lock_timeout: lock_timeout,
    log_level: log_level,
    logger: logger,
    requeue_interval: requeue_interval,
    unique_at_runtime_key_base: unique_at_runtime_key_base
  }
end