Class: Mistilteinn::Config
- Inherits:
-
Object
- Object
- Mistilteinn::Config
- Defined in:
- lib/mistilteinn/config.rb
Defined Under Namespace
Classes: WrapObj
Class Method Summary collapse
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(hash, path = nil) ⇒ Config
constructor
A new instance of Config.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(hash, path = nil) ⇒ Config
Returns a new instance of Config.
21 22 23 24 |
# File 'lib/mistilteinn/config.rb', line 21 def initialize(hash, path = nil) @hash = hash @path = path end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Class Method Details
.load(path) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/mistilteinn/config.rb', line 13 def self.load(path) if File.exist? path then self.new(YAML.load_file(path), path) else self.new({} , path) end end |
Instance Method Details
#exist? ⇒ Boolean
26 27 28 |
# File 'lib/mistilteinn/config.rb', line 26 def exist? File.exist?(@path) if @path end |