Class: Langouste::Configuration

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

Overview

Singleton configuration class

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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.expand_path(File.dirname(__FILE__)), '../config/langouste.yaml')
  @data = SymbolTable.new YAML.load_file @path
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



12
13
14
# File 'lib/langouste.rb', line 12

def data
  @data
end

#pathObject

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