class Firebolt::Config

Constants

CACHE_FILENAME

Public Class Methods

new(options = {}) click to toggle source

Constructor!

# File lib/firebolt/config.rb, line 8
def initialize(options = {})
  merge!(options)

  self[:cache_file_path] ||= '/tmp'
  self[:namespace] ||= ::SecureRandom.hex
end

Public Instance Methods

cache_file() click to toggle source

Public instance methods

# File lib/firebolt/config.rb, line 52
def cache_file
  ::File.join(self[:cache_file_path], CACHE_FILENAME)
end
cache_file_enabled?() click to toggle source
# File lib/firebolt/config.rb, line 56
def cache_file_enabled?
  !! ::Firebolt.config.cache_file_enabled
end
cache_file_path=(path) click to toggle source
# File lib/firebolt/config.rb, line 60
def cache_file_path=(path)
  raise ArgumentError, "Directory '#{path}' does not exist or is not writable." unless ::File.writable?(path)

  self[:cache_file_path] = path
end
cache_file_readable?() click to toggle source
# File lib/firebolt/config.rb, line 66
def cache_file_readable?
  ::File.readable?(cache_file)
end
namespace() click to toggle source
# File lib/firebolt/config.rb, line 70
def namespace
  @namespace ||= "firebolt.#{self[:namespace]}"
end
use_file_warmer?() click to toggle source
# File lib/firebolt/config.rb, line 74
def use_file_warmer?
  cache_file_enabled? && cache_file_readable?
end
warmer=(value) click to toggle source
# File lib/firebolt/config.rb, line 78
def warmer=(value)
  raise ArgumentError, "Warmer must include the ::Firebolt::Warmer module." unless value.ancestors.include?(::Firebolt::Warmer)
  raise ArgumentError, "Warmer must respond to #perform." unless value.instance_methods.include?(:perform)

  self[:warmer] = value
end