Class: ProcessSettings::Monitor

Inherits:
FileMonitor show all
Defined in:
lib/process_settings/monitor.rb

Overview

DEPRECATED

Class Attribute Summary collapse

Attributes inherited from FileMonitor

#file_path, #untargeted_settings

Attributes inherited from AbstractMonitor

#full_context_cache, #logger, #min_polling_seconds, #static_context, #statically_targeted_settings

Class Method Summary collapse

Methods inherited from FileMonitor

#initialize, #listen_thread_running?, #restart_after_fork, #start, #start_watchdog_thread, #stop_watchdog_thread

Methods inherited from AbstractMonitor

#[], #cancel_when_updated, ensure_no_symbols, #full_context_from_cache, #initialize, #on_change, #targeted_value, #when_updated

Constructor Details

This class inherits a constructor from ProcessSettings::FileMonitor

Class Attribute Details

.file_pathObject

Returns the value of attribute file_path.



12
13
14
# File 'lib/process_settings/monitor.rb', line 12

def file_path
  @file_path
end

.instanceObject



36
37
38
39
40
41
42
43
# File 'lib/process_settings/monitor.rb', line 36

def instance
  if @instance
    @instance
  else
    deprecator.warn("`ProcessSettings::Monitor.instance` lazy create is deprecated and will be removed in v1.0. Assign a `FileMonitor` object to `ProcessSettings.instance =` instead.")
    @instance = default_instance
  end
end

.loggerObject

Returns the value of attribute logger.



12
13
14
# File 'lib/process_settings/monitor.rb', line 12

def logger
  @logger
end

Class Method Details

.clear_instanceObject



31
32
33
34
# File 'lib/process_settings/monitor.rb', line 31

def clear_instance
  @instance = nil
  @default_instance = nil
end

.default_instanceObject



45
46
47
48
# File 'lib/process_settings/monitor.rb', line 45

def default_instance
  deprecator.warn("`ProcessSettings::Monitor.instance` is deprecated and will be removed in v1.0. Assign a `FileMonitor` object to `ProcessSettings.instance =` instead.")
  @default_instance ||= new_from_settings
end

.deprecatorObject



15
16
17
# File 'lib/process_settings/monitor.rb', line 15

def deprecator
  @deprecator ||= ActiveSupport::Deprecation.new('1.0', 'ProcessSettings')
end

.new_from_settingsObject



25
26
27
28
29
# File 'lib/process_settings/monitor.rb', line 25

def new_from_settings
  file_path or raise ArgumentError, "#{self}::file_path must be set before calling instance method"
  logger or raise ArgumentError, "#{self}::logger must be set before calling instance method"
  new(file_path, logger: logger)
end