Class: Langouste::Configuration
- Inherits:
-
Object
- Object
- Langouste::Configuration
- Defined in:
- lib/langouste.rb
Overview
Singleton configuration class
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(path = nil) ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 |
# File 'lib/langouste.rb', line 14 def initialize(path = nil) @path = path || File.join(File.(File.dirname(__FILE__)), '../config/langouste.yaml') @data = SymbolTable.new YAML.load_file @path end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
12 13 14 |
# File 'lib/langouste.rb', line 12 def data @data end |
#path ⇒ Object
Returns the value of attribute path.
12 13 14 |
# File 'lib/langouste.rb', line 12 def path @path end |
Class Method Details
.instance(path = nil) ⇒ Object
19 20 21 |
# File 'lib/langouste.rb', line 19 def self.instance(path = nil) @__instance__ ||= new end |
.list(config_path = nil) ⇒ Object
23 24 25 |
# File 'lib/langouste.rb', line 23 def self.list(config_path = nil) Configuration.instance(config_path).data.services.keys end |