Class: Jung::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Config

Returns a new instance of Config.



11
12
13
14
15
# File 'lib/jung/config.rb', line 11

def initialize(options)
  @driver = options["driver"]
  @options = options["options"]
  Jung::Drivers.load options["driver"]
end

Instance Attribute Details

#driverObject (readonly)

Returns the value of attribute driver.



4
5
6
# File 'lib/jung/config.rb', line 4

def driver
  @driver
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/jung/config.rb', line 4

def options
  @options
end

Class Method Details

.load(file = "config/jung.yml", namespace = nil) ⇒ Object



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

def self.load(file = "config/jung.yml", namespace = nil)
  options = YAML.load_file file
  return self.new options[namespace.to_s]
end

Instance Method Details

#driver_constObject



17
18
19
# File 'lib/jung/config.rb', line 17

def driver_const
  Jung::Drivers.const_get self.driver.camelize
end