Class: Spawno::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



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

def initialize
  self.settings = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object



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

def method_missing(method_name)
  settings[method_name.to_s]
end

Instance Attribute Details

#settingsObject

Returns the value of attribute settings.



5
6
7
# File 'lib/spawno/config.rb', line 5

def settings
  @settings
end

Instance Method Details

#load_from_file(path) ⇒ Object



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

def load_from_file(path)
  self.settings.merge! YAML.load_file(path)
end

#setup(path = nil) ⇒ Object



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

def setup(path = nil)
  load_from_file(path) if path
end