Class: SplitIoClient::Engine::Parser::SplitTreatment
- Inherits:
-
Object
- Object
- SplitIoClient::Engine::Parser::SplitTreatment
- Defined in:
- lib/engine/parser/split_treatment.rb
Instance Method Summary collapse
- #call(keys, split, attributes = nil) ⇒ Object
-
#initialize(segments_repository) ⇒ SplitTreatment
constructor
A new instance of SplitTreatment.
Constructor Details
#initialize(segments_repository) ⇒ SplitTreatment
Returns a new instance of SplitTreatment.
5 6 7 |
# File 'lib/engine/parser/split_treatment.rb', line 5 def initialize(segments_repository) @segments_repository = segments_repository end |
Instance Method Details
#call(keys, split, attributes = nil) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/engine/parser/split_treatment.rb', line 9 def call(keys, split, attributes = nil) split_model = Models::Split.new(split) default_treatment = split[:defaultTreatment] return Treatments::CONTROL if split_model.archived? split_model.matchable? ? match(split, keys, attributes, default_treatment) : default_treatment end |