Class: ThisFeature::Adapters::SplitIo
- Defined in:
- lib/this_feature/adapters/split_io.rb
Constant Summary collapse
- UNDEFINED_KEY =
used as treatment key when none is given, it’s required by split
'undefined_key'
Instance Method Summary collapse
- #control?(flag_name, context: UNDEFINED_KEY, data: {}) ⇒ Boolean
-
#initialize(client: nil) ⇒ SplitIo
constructor
A new instance of SplitIo.
- #off?(flag_name, context: UNDEFINED_KEY, data: {}) ⇒ Boolean
- #on?(flag_name, context: UNDEFINED_KEY, data: {}) ⇒ Boolean
- #present?(flag_name) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(client: nil) ⇒ SplitIo
Returns a new instance of SplitIo.
9 10 11 12 13 |
# File 'lib/this_feature/adapters/split_io.rb', line 9 def initialize(client: nil) @client = client || default_split_client @client.block_until_ready end |
Instance Method Details
#control?(flag_name, context: UNDEFINED_KEY, data: {}) ⇒ Boolean
19 20 21 |
# File 'lib/this_feature/adapters/split_io.rb', line 19 def control?(flag_name, context: UNDEFINED_KEY, data: {}) treatment(flag_name, context: context, data: data).include?('control') end |
#off?(flag_name, context: UNDEFINED_KEY, data: {}) ⇒ Boolean
27 28 29 |
# File 'lib/this_feature/adapters/split_io.rb', line 27 def off?(flag_name, context: UNDEFINED_KEY, data: {}) treatment(flag_name, context: context, data: data).eql?('off') end |
#on?(flag_name, context: UNDEFINED_KEY, data: {}) ⇒ Boolean
23 24 25 |
# File 'lib/this_feature/adapters/split_io.rb', line 23 def on?(flag_name, context: UNDEFINED_KEY, data: {}) treatment(flag_name, context: context, data: data).eql?('on') end |
#present?(flag_name) ⇒ Boolean
15 16 17 |
# File 'lib/this_feature/adapters/split_io.rb', line 15 def present?(flag_name) !control?(flag_name) end |