Class: AmplitudeExperiment::Evaluation::Segment

Inherits:
Object
  • Object
show all
Defined in:
lib/experiment/evaluation/flag.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#bucketObject

Returns the value of attribute bucket.



54
55
56
# File 'lib/experiment/evaluation/flag.rb', line 54

def bucket
  @bucket
end

#conditionsObject

Returns the value of attribute conditions.



54
55
56
# File 'lib/experiment/evaluation/flag.rb', line 54

def conditions
  @conditions
end

#metadataObject

Returns the value of attribute metadata.



54
55
56
# File 'lib/experiment/evaluation/flag.rb', line 54

def 
  @metadata
end

#variantObject

Returns the value of attribute variant.



54
55
56
# File 'lib/experiment/evaluation/flag.rb', line 54

def variant
  @variant
end

Class Method Details

.from_hash(hash) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/experiment/evaluation/flag.rb', line 56

def self.from_hash(hash)
  new.tap do |segment|
    segment.bucket = hash['bucket'] && Bucket.from_hash(hash['bucket'])
    segment.conditions = hash['conditions']&.map { |c| c.map { |inner| Condition.from_hash(inner) } }
    segment.variant = hash['variant']
    segment. = hash['metadata']
  end
end