Class: Juvet::Configuration::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/juvet/configuration/adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = nil, options = {}) ⇒ Adapter

Returns a new instance of Adapter.



8
9
10
11
12
13
14
# File 'lib/juvet/configuration/adapter.rb', line 8

def initialize(type=nil, options={})
  opts = (options || {}).dup

  @type = type || :null
  @options = opts
  @class_name = Juvet::String.new("#{self.type}_adapter").classify
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



4
5
6
# File 'lib/juvet/configuration/adapter.rb', line 4

def class_name
  @class_name
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/juvet/configuration/adapter.rb', line 5

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/juvet/configuration/adapter.rb', line 6

def type
  @type
end

Instance Method Details

#buildObject



16
17
18
19
# File 'lib/juvet/configuration/adapter.rb', line 16

def build
  load_adapter
  Juvet::Adapters.const_get(class_name)
end