Class: SplitIoClient::Engine::Parser::SplitTreatment

Inherits:
Object
  • Object
show all
Defined in:
lib/engine/parser/split_treatment.rb

Instance Method Summary collapse

Constructor Details

#initialize(splits_repository, segments_repository) ⇒ SplitTreatment

Returns a new instance of SplitTreatment.



5
6
7
8
# File 'lib/engine/parser/split_treatment.rb', line 5

def initialize(splits_repository, segments_repository)
  @splits_repository = splits_repository
  @segments_repository = segments_repository
end

Instance Method Details

#call(keys, split_name, default_treatment, attributes = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/engine/parser/split_treatment.rb', line 10

def call(keys, split_name, default_treatment, attributes = nil)
  split = @splits_repository.get_split(split_name)

  return Treatments::CONTROL if self.class.archived?(split)

  matchable?(split) ? match(split, keys, attributes, default_treatment) : default_treatment
end