Class: Verdict::Segmenters::RolloutSegmenter::Group

Inherits:
Group
  • Object
show all
Defined in:
lib/verdict/segmenters/rollout_segmenter.rb

Instance Attribute Summary collapse

Attributes inherited from Group

#experiment, #handle

Instance Method Summary collapse

Methods inherited from Group

#===, #to_json, #to_sym

Methods included from Metadata

#description, included, #name, #owner, #screenshot

Constructor Details

#initialize(experiment, handle, percentile_range) ⇒ Group

Returns a new instance of Group.



36
37
38
39
# File 'lib/verdict/segmenters/rollout_segmenter.rb', line 36

def initialize(experiment, handle, percentile_range)
  super(experiment, handle)
  @percentile_range = percentile_range
end

Instance Attribute Details

#percentile_rangeObject (readonly)

Returns the value of attribute percentile_range.



34
35
36
# File 'lib/verdict/segmenters/rollout_segmenter.rb', line 34

def percentile_range
  @percentile_range
end

Instance Method Details

#as_json(options = {}) ⇒ Object



49
50
51
# File 'lib/verdict/segmenters/rollout_segmenter.rb', line 49

def as_json(options = {})
  super(options).merge(percentage: percentage_size)
end

#percentage_sizeObject



41
42
43
# File 'lib/verdict/segmenters/rollout_segmenter.rb', line 41

def percentage_size
  percentile_range.end - percentile_range.begin
end

#to_sObject



45
46
47
# File 'lib/verdict/segmenters/rollout_segmenter.rb', line 45

def to_s
  "#{handle} (#{percentage_size}%)"
end