Class: HipChatSecrets::SettingsFile

Inherits:
Object
  • Object
show all
Defined in:
lib/settings_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(setting_path = nil) ⇒ SettingsFile

Returns a new instance of SettingsFile.



8
9
10
11
12
13
# File 'lib/settings_file.rb', line 8

def initialize setting_path=nil
  configs = find_configs(setting_path)
  raise "Could not locate any config files." if configs.length < 1
  @config_file = configs.first
  parse_config
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object

pass unknown method calls to the config object



16
17
18
19
20
21
22
# File 'lib/settings_file.rb', line 16

def method_missing meth, *args, &block
  if @config.include? meth.to_s
    @config[meth.to_s]
  else
    super
  end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/settings_file.rb', line 6

def config
  @config
end

#config_fileObject (readonly)

Returns the value of attribute config_file.



6
7
8
# File 'lib/settings_file.rb', line 6

def config_file
  @config_file
end