Class: Mystro::Config
- Inherits:
-
Object
- Object
- Mystro::Config
- Defined in:
- lib/mystro/config.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mystro/config.rb', line 11 def initialize f = "#{Mystro.directory}/config.yml" d = File.exists?(f) ? YAML.load_file(f) : {} c = Hashie::Mash.new(d) if c.logging? c.logging.each do |level, dest| Mystro::Log.add(level.to_sym, dest) end end Mystro::Log.debug "loading plugins from configuration" Mystro::Plugin.load(c[:plugins]) if c[:plugins] @raw = c @data = Hashie::Mash.new(c) @data.directory = Mystro.directory end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/mystro/config.rb', line 9 def data @data end |
Class Method Details
.instance ⇒ Object
4 5 6 |
# File 'lib/mystro/config.rb', line 4 def instance @instance ||= self.new end |