Class: Juden::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/juden/config.rb

Overview

read keymap from yaml file

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



11
12
13
14
# File 'lib/juden/config.rb', line 11

def initialize
  @custom_path = nil
  reload
end

Instance Attribute Details

#custom_pathObject

Returns the value of attribute custom_path.



9
10
11
# File 'lib/juden/config.rb', line 9

def custom_path
  @custom_path
end

#keymapObject (readonly)

Returns the value of attribute keymap.



8
9
10
# File 'lib/juden/config.rb', line 8

def keymap
  @keymap
end

Instance Method Details

#device_nameObject



34
35
36
# File 'lib/juden/config.rb', line 34

def device_name
  keymap['device_name']
end

#interval_secondsObject



26
27
28
# File 'lib/juden/config.rb', line 26

def interval_seconds
  keymap['interval_seconds']
end

#reloadObject



16
17
18
19
20
# File 'lib/juden/config.rb', line 16

def reload
  @cache  = nil
  @keymap = YAML.load_file(file_path)
  self
end

#threshold_percentageObject



22
23
24
# File 'lib/juden/config.rb', line 22

def threshold_percentage
  keymap['threshold_percentage']
end

#webhook_urlObject



30
31
32
# File 'lib/juden/config.rb', line 30

def webhook_url
  keymap['webhook_url']
end