Class: Hackle::ConditionMatcherFactory
- Inherits:
-
Object
- Object
- Hackle::ConditionMatcherFactory
- Defined in:
- lib/hackle/internal/evaluation/match/condition/condition_matcher_factory.rb
Instance Method Summary collapse
- #get(key_type) ⇒ ConditionMatcher
-
#initialize(evaluator:) ⇒ ConditionMatcherFactory
constructor
A new instance of ConditionMatcherFactory.
Constructor Details
#initialize(evaluator:) ⇒ ConditionMatcherFactory
Returns a new instance of ConditionMatcherFactory.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/hackle/internal/evaluation/match/condition/condition_matcher_factory.rb', line 14 def initialize(evaluator:) value_operator_matcher = ValueOperatorMatcher.new( value_matcher_factory: ValueMatcherFactory.new, operator_matcher_factory: OperatorMatcherFactory.new ) @user_condition_matcher = UserConditionMatcher.new( user_value_resolver: UserValueResolver.new, value_operator_matcher: value_operator_matcher ) @segment_condition_matcher = SegmentConditionMatcher.new( segment_matcher: SegmentMatcher.new(user_condition_matcher: @user_condition_matcher) ) @experiment_condition_matcher = ExperimentConditionMatcher.new( ab_test_matcher: AbTestEvaluatorMatcher.new( evaluator: evaluator, value_operator_matcher: value_operator_matcher ), feature_flag_matcher: FeatureFlagEvaluatorMatcher.new( evaluator: evaluator, value_operator_matcher: value_operator_matcher ) ) end |
Instance Method Details
#get(key_type) ⇒ ConditionMatcher
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hackle/internal/evaluation/match/condition/condition_matcher_factory.rb', line 40 def get(key_type) case key_type when TargetKeyType::USER_ID, TargetKeyType::USER_PROPERTY, TargetKeyType::HACKLE_PROPERTY @user_condition_matcher when TargetKeyType::SEGMENT @segment_condition_matcher when TargetKeyType::AB_TEST, TargetKeyType::FEATURE_FLAG @experiment_condition_matcher else raise ArgumentError, "unsupported TargetKeyType [#{key_type}]" end end |