class Services::Config::ConfigStruct

Attributes

config[R]
queue_names[R]
rabbit_mq[R]

Public Class Methods

new(config_hash = nil) click to toggle source
# File lib/services/config/config_struct.rb, line 15
def initialize(config_hash = nil)
  setup_vars(config_hash)
end

Public Instance Methods

setup_vars(config_hash) click to toggle source
# File lib/services/config/config_struct.rb, line 19
def setup_vars(config_hash)
  if !config_hash.nil?
    @is_basic = config_hash.fetch(BASIC_KEY, false)
    @config_hash = config_hash
    @config = Struct::Config.new(config_hash[ROOT_KEY])
    @queue_names = config_hash[ROOT_KEY][QUEUE_NAME_KEY].map do |val|
      params = QUEUE_NAME_KEYS.map { |key| val.fetch(key, nil) }
      Struct::QueueName.new(*params)
    end
    @rabbit_mq = Struct::RabbitMq.new(config_hash[ROOT_KEY][CONNECTION_STRING_KEY], @queue_names)
  else
    throw Services::Config::Errors::InvalidConfig.new(e.message, INIT_ERR_MSG)
  end
end