Class: AmplitudeExperiment::Variant

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

Overview

Variant

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, payload = nil) ⇒ Variant

Returns a new instance of Variant.

Parameters:

  • value (String)

    The value of the variant determined by the flag configuration.

  • payload (Object, nil) (defaults to: nil)

    The attached payload, if any.



14
15
16
17
# File 'lib/experiment/variant.rb', line 14

def initialize(value, payload = nil)
  @value = value
  @payload = payload
end

Instance Attribute Details

#payloadObject?

The attached payload, if any.

Returns:

  • (Object, nil)

    the value of variant payload



10
11
12
# File 'lib/experiment/variant.rb', line 10

def payload
  @payload
end

#valueString

The value of the variant determined by the flag configuration.

Returns:

  • (String)

    the value of variant value



6
7
8
# File 'lib/experiment/variant.rb', line 6

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object

Determine if current variant equal other variant

Parameters:



21
22
23
24
# File 'lib/experiment/variant.rb', line 21

def ==(other)
  value == other.value &&
    payload == other.payload
end