Method: Quebert::Configuration#from_hash

Defined in:
lib/quebert/configuration.rb

#from_hash(hash) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/quebert/configuration.rb', line 23

def from_hash(hash)
  hash = Support.symbolize_keys(hash)
  # Find out backend from the registry and configure
  if backend = Quebert.backends[hash.delete(:backend).to_sym]
    # If the backend supports configuration, do it!
    self.backend = backend.respond_to?(:configure) ? backend.configure(Support.symbolize_keys(hash)) : backend.new
  end
  self
end