Class: Rox::Core::InternalFlags
- Inherits:
-
Object
- Object
- Rox::Core::InternalFlags
- Defined in:
- lib/rox/core/client/internal_flags.rb
Constant Summary collapse
- @@defaults_self_managed =
{ 'rox.internal.pushUpdates' => false, 'rox.internal.considerThrottleInPush' => false, 'rox.internal.throttleFetchInSeconds' => 0 }
Instance Method Summary collapse
- #enabled?(flag_name) ⇒ Boolean
-
#initialize(experiment_repository, parser, rox_options) ⇒ InternalFlags
constructor
A new instance of InternalFlags.
Constructor Details
#initialize(experiment_repository, parser, rox_options) ⇒ InternalFlags
Returns a new instance of InternalFlags.
12 13 14 15 16 |
# File 'lib/rox/core/client/internal_flags.rb', line 12 def initialize(experiment_repository, parser, ) @experiment_repository = experiment_repository @parser = parser @rox_options = end |
Instance Method Details
#enabled?(flag_name) ⇒ Boolean
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rox/core/client/internal_flags.rb', line 18 def enabled?(flag_name) if @rox_options.self_managed? value = @@defaults_self_managed[flag_name] return value unless value.nil? end internal_experiment = @experiment_repository.experiment_by_flag(flag_name) return false if internal_experiment.nil? value = @parser.evaluate_expression(internal_experiment.condition, nil).string_value value == Flag::FLAG_TRUE_VALUE end |