Class: MetricsEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/ff/ruby/server/sdk/api/metrics_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feature_config, target, variation) ⇒ MetricsEvent

Returns a new instance of MetricsEvent.



5
6
7
8
9
10
11
# File 'lib/ff/ruby/server/sdk/api/metrics_event.rb', line 5

def initialize(feature_config, target, variation)

  @target = target
  @variation = variation
  @feature_config = feature_config
  freeze
end

Instance Attribute Details

#feature_configObject

Returns the value of attribute feature_config.



3
4
5
# File 'lib/ff/ruby/server/sdk/api/metrics_event.rb', line 3

def feature_config
  @feature_config
end

#targetObject

Returns the value of attribute target.



3
4
5
# File 'lib/ff/ruby/server/sdk/api/metrics_event.rb', line 3

def target
  @target
end

#variationObject

Returns the value of attribute variation.



3
4
5
# File 'lib/ff/ruby/server/sdk/api/metrics_event.rb', line 3

def variation
  @variation
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
# File 'lib/ff/ruby/server/sdk/api/metrics_event.rb', line 13

def ==(other)
  eql?(other)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/ff/ruby/server/sdk/api/metrics_event.rb', line 17

def eql?(other)
  feature_config.feature == other.feature_config.feature and
    variation.identifier == other.variation.identifier and
    target.identifier == other.target.identifier
end

#hashObject



23
24
25
# File 'lib/ff/ruby/server/sdk/api/metrics_event.rb', line 23

def hash
  feature_config.feature.hash | variation.identifier.hash | target.identifier.hash
end