Class: Herder::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



6
7
8
9
10
11
12
13
# File 'lib/herder/config.rb', line 6

def initialize
  self.options = YAML.load_file("config/herder.yml")
rescue
  self.options = {}
  options["site"] = ENV["HERDER_SITE"] || "http://localhost"
  options["user"] = ENV["HERDER_USER"] || "user"
  options["password"] = ENV["HERDER_PASSWORD"] || "password"
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/herder/config.rb', line 4

def options
  @options
end

Class Method Details

.get(key) ⇒ Object



15
16
17
# File 'lib/herder/config.rb', line 15

def self.get key
  self.instance.options[key]
end

.instanceObject



19
20
21
# File 'lib/herder/config.rb', line 19

def self.instance
  @instance ||= Herder::Config.new
end