Class: AmplitudeExperiment::Evaluation::Variant

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key.



67
68
69
# File 'lib/experiment/evaluation/flag.rb', line 67

def key
  @key
end

#metadataObject

Returns the value of attribute metadata.



67
68
69
# File 'lib/experiment/evaluation/flag.rb', line 67

def 
  @metadata
end

#payloadObject

Returns the value of attribute payload.



67
68
69
# File 'lib/experiment/evaluation/flag.rb', line 67

def payload
  @payload
end

#valueObject

Returns the value of attribute value.



67
68
69
# File 'lib/experiment/evaluation/flag.rb', line 67

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object



73
74
75
76
77
78
79
80
# File 'lib/experiment/evaluation/flag.rb', line 73

def self.from_hash(hash)
  new.tap do |variant|
    variant.key = hash['key']
    variant.value = hash['value']
    variant.payload = hash['payload']
    variant. = hash['metadata']
  end
end

Instance Method Details

#[](key) ⇒ Object



69
70
71
# File 'lib/experiment/evaluation/flag.rb', line 69

def [](key)
  instance_variable_get("@#{key}")
end