class Nsqcd::Configuration

Constants

DEFAULTS
QUEUE_OPTION_DEFAULTS

Public Class Methods

new() click to toggle source
# File lib/nsqcd/configuration.rb, line 45
def initialize
  clear
end

Public Instance Methods

clear() click to toggle source
# File lib/nsqcd/configuration.rb, line 49
def clear
  @hash = DEFAULTS.dup
end
deep_merge(first, second) click to toggle source
# File lib/nsqcd/configuration.rb, line 65
def deep_merge(first, second)
  merger = proc { |_, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
  first.merge(second, &merger)
end
merge(hash) click to toggle source
# File lib/nsqcd/configuration.rb, line 58
def merge(hash)
  instance = self.class.new
  instance.merge! to_hash
  instance.merge! hash
  instance
end
merge!(hash) click to toggle source
# File lib/nsqcd/configuration.rb, line 53
def merge!(hash)
  hash = hash.dup
  @hash = deep_merge(@hash, hash)
end