Class: AcpcTableManager::Config

Inherits:
NilDefaultConfig show all
Includes:
SimpleLogging
Defined in:
lib/acpc_table_manager/config.rb

Constant Summary collapse

THIS_MACHINE =
Socket.gethostname
DEALER_HOST =
THIS_MACHINE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SimpleLogging

#log, #log_with, #logger

Methods inherited from NilDefaultConfig

#method_missing

Constructor Details

#initialize(file_path, log_directory_, match_log_directory_, proxy_pids_file_, interpolation_hash) ⇒ Config

Returns a new instance of Config.



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/acpc_table_manager/config.rb', line 29

def initialize(file_path, log_directory_, match_log_directory_, proxy_pids_file_, interpolation_hash)
  @file = file_path
  JSON.parse(File.read(file_path)).each do |constant, val|
    define_singleton_method(constant.to_sym) do
      ::AcpcTableManager.interpolate_all_strings(val, interpolation_hash)
    end
  end
  @log_directory = log_directory_
  @match_log_directory = match_log_directory_
  @my_log_directory = File.join(@log_directory, 'acpc_table_manager')
  @proxy_pids_file = proxy_pids_file_
  @logger = Logger.from_file_name(File.join(@my_log_directory, 'config.log'))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AcpcTableManager::NilDefaultConfig

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



27
28
29
# File 'lib/acpc_table_manager/config.rb', line 27

def file
  @file
end

#log_directoryObject (readonly)

Returns the value of attribute log_directory.



27
28
29
# File 'lib/acpc_table_manager/config.rb', line 27

def log_directory
  @log_directory
end

#match_log_directoryObject (readonly)

Returns the value of attribute match_log_directory.



27
28
29
# File 'lib/acpc_table_manager/config.rb', line 27

def match_log_directory
  @match_log_directory
end

#my_log_directoryObject (readonly)

Returns the value of attribute my_log_directory.



27
28
29
# File 'lib/acpc_table_manager/config.rb', line 27

def my_log_directory
  @my_log_directory
end

#proxy_pids_fileObject (readonly)

Returns the value of attribute proxy_pids_file.



27
28
29
# File 'lib/acpc_table_manager/config.rb', line 27

def proxy_pids_file
  @proxy_pids_file
end

Instance Method Details

#dealer_hostObject



44
# File 'lib/acpc_table_manager/config.rb', line 44

def dealer_host() DEALER_HOST end

#this_machineObject



43
# File 'lib/acpc_table_manager/config.rb', line 43

def this_machine() THIS_MACHINE end