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 17 18 19 20 |
# 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 treatment(Models::Label::ARCHIVED, Treatments::CONTROL, split[:changeNumber]) if split_model.archived? if split_model.matchable? match(split, keys, attributes) else treatment(Models::Label::KILLED, @default_treatment, split[:changeNumber]) end end |