Class: AcpcTableManager::Config
- Inherits:
-
NilDefaultConfig
- Object
- NilDefaultConfig
- AcpcTableManager::Config
- 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
-
#data_directory ⇒ Object
readonly
Returns the value of attribute data_directory.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#log_directory ⇒ Object
readonly
Returns the value of attribute log_directory.
-
#match_log_directory ⇒ Object
readonly
Returns the value of attribute match_log_directory.
-
#my_log_directory ⇒ Object
readonly
Returns the value of attribute my_log_directory.
Instance Method Summary collapse
- #dealer_host ⇒ Object
-
#initialize(file_path, log_directory_, match_log_directory_, data_directory_, interpolation_hash) ⇒ Config
constructor
A new instance of Config.
- #this_machine ⇒ Object
Methods included from SimpleLogging
Methods inherited from NilDefaultConfig
Constructor Details
#initialize(file_path, log_directory_, match_log_directory_, data_directory_, interpolation_hash) ⇒ Config
Returns a new instance of Config.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/acpc_table_manager/config.rb', line 30 def initialize( file_path, log_directory_, match_log_directory_, data_directory_, 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') @logger = Logger.from_file_name(File.join(@my_log_directory, 'table_manager.log')) @data_directory = data_directory_ FileUtils.mkdir_p @data_directory unless File.directory?(@data_directory) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class AcpcTableManager::NilDefaultConfig
Instance Attribute Details
#data_directory ⇒ Object (readonly)
Returns the value of attribute data_directory.
22 23 24 |
# File 'lib/acpc_table_manager/config.rb', line 22 def data_directory @data_directory end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
22 23 24 |
# File 'lib/acpc_table_manager/config.rb', line 22 def file @file end |
#log_directory ⇒ Object (readonly)
Returns the value of attribute log_directory.
22 23 24 |
# File 'lib/acpc_table_manager/config.rb', line 22 def log_directory @log_directory end |
#match_log_directory ⇒ Object (readonly)
Returns the value of attribute match_log_directory.
22 23 24 |
# File 'lib/acpc_table_manager/config.rb', line 22 def match_log_directory @match_log_directory end |
#my_log_directory ⇒ Object (readonly)
Returns the value of attribute my_log_directory.
22 23 24 |
# File 'lib/acpc_table_manager/config.rb', line 22 def my_log_directory @my_log_directory end |
Instance Method Details
#dealer_host ⇒ Object
52 |
# File 'lib/acpc_table_manager/config.rb', line 52 def dealer_host() DEALER_HOST end |
#this_machine ⇒ Object
51 |
# File 'lib/acpc_table_manager/config.rb', line 51 def this_machine() THIS_MACHINE end |