Class: Spanx::Config

Inherits:
Hash
  • Object
show all
Includes:
Helper::Exit
Defined in:
lib/spanx/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::Exit

#error_exit_with_msg, #help_exit

Constructor Details

#initialize(filename) ⇒ Config

Returns a new instance of Config.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/spanx/config.rb', line 12

def initialize(filename)
  super
  @filename = filename
  load_file

  Pause.configure do |pause|
    pause.redis_host = self[:redis][:host]
    pause.redis_port = self[:redis][:port]
    pause.redis_db = self[:redis][:database]

    pause.resolution = self[:collector][:resolution]
    pause.history = self[:collector][:history]
  end

  if self.has_key?(:analyzer) && self[:analyzer].has_key?(:period_checks)
    self[:analyzer][:period_checks].each do |check|
      Spanx::IPChecker.check(check)
    end
  end

  self
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



10
11
12
# File 'lib/spanx/config.rb', line 10

def filename
  @filename
end