Class: Convergence::Config
- Inherits:
-
Object
- Object
- Convergence::Config
- Defined in:
- lib/convergence/config.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#database ⇒ Object
Returns the value of attribute database.
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(attributes) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 |
# File 'lib/convergence/config.rb', line 7 def initialize(attributes) attributes.each do |k, v| instance_variable_set("@#{k}", v) unless v.nil? end end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
5 6 7 |
# File 'lib/convergence/config.rb', line 5 def adapter @adapter end |
#database ⇒ Object
Returns the value of attribute database.
5 6 7 |
# File 'lib/convergence/config.rb', line 5 def database @database end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/convergence/config.rb', line 5 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/convergence/config.rb', line 5 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
5 6 7 |
# File 'lib/convergence/config.rb', line 5 def port @port end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/convergence/config.rb', line 5 def username @username end |
Class Method Details
.load(yaml_path) ⇒ Object
13 14 15 16 |
# File 'lib/convergence/config.rb', line 13 def self.load(yaml_path) setting = YAML.load(ERB.new(File.read(yaml_path)).result) new(setting) end |