Class: Convergence::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#adapterObject

Returns the value of attribute adapter.



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

def adapter
  @adapter
end

#databaseObject

Returns the value of attribute database.



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

def database
  @database
end

#hostObject

Returns the value of attribute host.



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

def host
  @host
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#usernameObject

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