lib/ldclient-rb/evaluation.rb
# Evaluates a feature flag, returning a hash containing the evaluation result and any events
# generated during prerequisite evaluation. Raises EvaluationError if the flag is not well-formed
# Will return nil, but not raise an exception, indicating that the rules (including fallthrough) did not match
# In that case, the caller should return the default value.
Evaluates a feature flag, returning a hash containing the evaluation result and any events
generated during prerequisite evaluation. Raises EvaluationError if the flag is not well-formed
Will return nil, but not raise an exception, indicating that the rules (including fallthrough) did not match
In that case, the caller should return the default value.
Evaluates a feature flag returning a hash containing the evaluation result and any events generated during prerequisite evaluation . Raises EvaluationError if the flag is not well - formed Will return nil but not raise an exception indicating that the rules ( including fallthrough ) did not match In that case the caller should return the default value .
def evaluate(flag, user, store)
      if flag.nil?
        raise EvaluationError, "Flag does not exist"
      end
      if user.nil? || user[:key].nil?
        raise EvaluationError, "Invalid user"
      end
      events = []
      if flag[:on]
        res = eval_internal(flag, user, store, events)
        return { value: res, events: events } if !res.nil?
      end
      if !flag[:offVariation].nil? && flag[:offVariation] < flag[:variations].length
        value = flag[:variations][flag[:offVariation]]
        return { value: value, events: events }
      end
      { value: nil, events: events }
    end
def evaluate ( flag , user , store ) if flag . nil? raise EvaluationError , "Flag does not exist" end if user . nil? || user [ :key ] . nil? raise EvaluationError , "Invalid user" end events = [ ] if flag [ :on ] res = eval_internal ( flag , user , store , events ) return { value : res , events : events } if ! res . nil? end if ! flag [ :offVariation ] . nil? && flag [ :offVariation ] < flag [ :variations ] . length value = flag [ :variations ] [ flag [ :offVariation ] ] return { value : value , events : events } end { value : nil , events : events } end
Evaluates a feature flag, returning a hash containing the evaluation result and any events
generated during prerequisite evaluation.
Evaluates a feature flag returning a hash containing the evaluation result and any events generated during prerequisite evaluation .
flag
user
store