Class: ThisFeature::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#adaptersObject



17
18
19
# File 'lib/this_feature/configuration.rb', line 17

def adapters
  @adapters ||= []
end

#base_data_lambdaObject



29
30
31
# File 'lib/this_feature/configuration.rb', line 29

def base_data_lambda
  @base_data_lambda ||= ->(_record) { {} }
end

#default_adapterObject



21
22
23
# File 'lib/this_feature/configuration.rb', line 21

def default_adapter
  @default_adapter ||= adapters.first
end

#test_adapterObject



25
26
27
# File 'lib/this_feature/configuration.rb', line 25

def test_adapter
  @test_adapter ||= Adapters::Memory.new
end

Instance Method Details

#initObject



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

def init
  validate_adapters!
end

#validate_adapters!Object

Raises:



9
10
11
12
13
14
15
# File 'lib/this_feature/configuration.rb', line 9

def validate_adapters!
  raise NoAdaptersError unless adapters.any?

  adapters.each do |adapter|
    raise BadAdapterError, adapter unless adapter.class < Adapters::Base
  end
end