Class: LaunchDarkly::Impl::Model::FlagRule

Inherits:
Object
  • Object
show all
Defined in:
lib/ldclient-rb/impl/model/feature_flag.rb

Overview

Since:

  • 5.5.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, rule_index, flag, errors_out = nil) ⇒ FlagRule

Returns a new instance of FlagRule.

Since:

  • 5.5.0



163
164
165
166
167
168
169
170
171
172
173
# File 'lib/ldclient-rb/impl/model/feature_flag.rb', line 163

def initialize(data, rule_index, flag, errors_out = nil)
  @data = data
  @clauses = (data[:clauses] || []).map do |clause_data|
    Clause.new(clause_data, errors_out)
  end
  @variation_or_rollout = VariationOrRollout.new(data[:variation], data[:rollout], flag, errors_out, 'rule')
  rule_id = data[:id]
  match_reason = EvaluationReason::rule_match(rule_index, rule_id)
  match_reason_in_experiment = EvaluationReason::rule_match(rule_index, rule_id, true)
  @match_results = Preprocessor.precompute_multi_variation_results(flag, match_reason, match_reason_in_experiment)
end

Instance Attribute Details

#clausesArray<LaunchDarkly::Impl::Model::Clause> (readonly)

Returns:

Since:

  • 5.5.0



178
179
180
# File 'lib/ldclient-rb/impl/model/feature_flag.rb', line 178

def clauses
  @clauses
end

#dataHash (readonly)

Returns:

  • (Hash)

Since:

  • 5.5.0



176
177
178
# File 'lib/ldclient-rb/impl/model/feature_flag.rb', line 176

def data
  @data
end

#match_resultsLaunchDarkly::Impl::Model::EvalResultFactoryMultiVariations (readonly)



180
181
182
# File 'lib/ldclient-rb/impl/model/feature_flag.rb', line 180

def match_results
  @match_results
end

#variation_or_rolloutLaunchDarkly::Impl::Model::VariationOrRollout (readonly)



182
183
184
# File 'lib/ldclient-rb/impl/model/feature_flag.rb', line 182

def variation_or_rollout
  @variation_or_rollout
end