Class: Lokii::Config

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

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



35
36
37
38
# File 'lib/lokii/config.rb', line 35

def self.[](key)
  self.setup
  return self.configuration[key.to_sym]
end

.[]=(key, value) ⇒ Object



40
41
42
43
44
# File 'lib/lokii/config.rb', line 40

def self.[]=(key, value)
  self.setup
  self.configuration[key.to_sym] = value
  return value
end

.environmentObject



31
32
33
# File 'lib/lokii/config.rb', line 31

def self.environment
  (defined?(LOKII_ENV) ? LOKII_ENV : ENV['LOKII_ENV'] || "development").to_sym
end

.rootObject



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

def self.root
  LOKII_ROOT
end

.setup(&block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/lokii/config.rb', line 16

def self.setup(&block)
  define_accessors :options, :configuration, :settings, :database, :messages
  self.options = {}
  block.call(self)
  load_config
  load_defaults
  load_application
  setup_defaults
  setup_database
end

.to_hashObject



46
47
48
# File 'lib/lokii/config.rb', line 46

def self.to_hash
  self.configuration
end