Class: Traquitana::Config

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

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



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

def initialize
	@configs = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth) ⇒ Object



27
28
29
30
# File 'lib/config.rb', line 27

def method_missing(meth)
	c = @configs[meth.to_sym]
	c ? c : ""
end

Instance Method Details

#configObject



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

def config
	"#{dir}/config.yml"
end

#defaultObject



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

def default
	"#{File.dirname(File.expand_path(__FILE__))}/../config/default.yml"
end

#dirObject



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

def dir
	"traq"
end

#loadObject



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

def load
	@configs = YAML.load(File.read(config))
end