Module: WatchTower::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/watch_tower/config.rb

Constant Summary collapse

@@config =

Define the config class variable

nil

Instance Method Summary collapse

Instance Method Details

#[](config) ⇒ Object

Return a particular config variable from the parsed config file

Parameters:

  • config (String|Symbol)

Returns:

  • mixed

Raises:

  • (Void)


17
18
19
20
21
22
23
24
# File 'lib/watch_tower/config.rb', line 17

def [](config)
  if @@config.nil?
    check_config_file
    @@config ||= parse_config_file
  end

  @@config[:watch_tower].send(:[], config)
end

#config_fileString

Get the config file

Returns:

  • (String)

    Absolute path to the config file



29
30
31
# File 'lib/watch_tower/config.rb', line 29

def config_file
  File.join(USER_PATH, 'config.yml')
end