Class: ThisFeature
- Inherits:
-
Object
show all
- Defined in:
- lib/this_feature.rb,
lib/this_feature/flag.rb,
lib/this_feature/errors.rb,
lib/this_feature/version.rb,
lib/this_feature/adapters.rb,
lib/this_feature/adapters/base.rb,
lib/this_feature/configuration.rb,
lib/this_feature/adapters/memory.rb,
lib/this_feature/adapters/flipper.rb,
lib/this_feature/adapters/split_io.rb
Defined Under Namespace
Modules: Adapters
Classes: BadAdapterError, Configuration, Error, Flag, NoAdaptersError, UnimplementedError
Constant Summary
collapse
- VERSION =
'0.10.0'.freeze
Class Method Summary
collapse
Class Method Details
.adapter_for(flag_name) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/this_feature.rb', line 14
def self.adapter_for(flag_name)
matching_adapter = adapters.find do |adapter|
adapter.present?(flag_name)
end
matching_adapter || configuration.default_adapter
end
|
.adapters ⇒ Object
34
35
36
|
# File 'lib/this_feature.rb', line 34
def self.adapters
configuration.adapters
end
|
.base_data_lambda ⇒ Object
42
43
44
|
# File 'lib/this_feature.rb', line 42
def self.base_data_lambda
configuration.base_data_lambda
end
|
.configuration ⇒ Object
22
23
24
|
# File 'lib/this_feature.rb', line 22
def self.configuration
@configuration ||= Configuration.new
end
|
26
27
28
29
30
31
32
|
# File 'lib/this_feature.rb', line 26
def self.configure
@configuration = Configuration.new
yield(configuration)
configuration.init
end
|
.flag(flag_name, context: nil, data: {}, record: nil) ⇒ Object
8
9
10
11
12
|
# File 'lib/this_feature.rb', line 8
def self.flag(flag_name, context: nil, data: {}, record: nil)
adapter = adapter_for(flag_name)
Flag.new(flag_name, adapter: adapter, context: context, data: data, record: record)
end
|
.test_adapter ⇒ Object
38
39
40
|
# File 'lib/this_feature.rb', line 38
def self.test_adapter
configuration.test_adapter
end
|