Class: Lafcadio::LafcadioConfig

Inherits:
Hash
  • Object
show all
Defined in:
lib/lafcadio/util/LafcadioConfig.rb

Overview

LafcadioConfig is a Hash that takes its data from the config file. You’ll have to set the location of that file before using it: Use LafcadioConfig.setFilename.

LafcadioConfig expects its data to be colon-delimited, one key-value pair to a line. For example:

dbuser:user
dbpassword:password
dbname:lafcadio_test
dbhost:localhost

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLafcadioConfig

Returns a new instance of LafcadioConfig.



17
18
19
20
21
22
23
# File 'lib/lafcadio/util/LafcadioConfig.rb', line 17

def initialize
 file = File.new @@filename
	file.each_line { |line|
		line.chomp =~ /^(.*?):(.*)$/
		self[$1] = $2
	}
end

Class Method Details

.setFilename(filename) ⇒ Object



13
14
15
# File 'lib/lafcadio/util/LafcadioConfig.rb', line 13

def LafcadioConfig.setFilename(filename)
	@@filename = filename
end