Class: PactBroker::Api::Contracts::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/api/contracts/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(overrides = {}) ⇒ Configuration

Returns a new instance of Configuration.



11
12
13
# File 'lib/pact_broker/api/contracts/configuration.rb', line 11

def initialize(overrides = {})
  @overrides = overrides
end

Class Method Details

.default_configurationObject



25
26
27
# File 'lib/pact_broker/api/contracts/configuration.rb', line 25

def self.default_configuration
  Configuration.new
end

Instance Method Details

#class_for(name) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/pact_broker/api/contracts/configuration.rb', line 15

def class_for(name)
  if overrides[name].is_a?(String)
    Object.const_get(overrides[name])
  elsif overrides[name].is_a?(Class)
    overrides[name]
  else
    Object.const_get("PactBroker::Api::Contracts::#{name.to_s.camelcase(true)}")
  end
end