lib/ff/ruby/server/sdk/api/metrics_event.rb in ff-ruby-server-sdk-1.0.6 vs lib/ff/ruby/server/sdk/api/metrics_event.rb in ff-ruby-server-sdk-1.1.0
- old
+ new
@@ -1,16 +1,28 @@
class MetricsEvent
attr_accessor :feature_config, :target, :variation
- def initialize(
+ def initialize(feature_config, target, variation)
- feature_config,
- target,
- variation
- )
-
@target = target
@variation = variation
@feature_config = feature_config
+ freeze
end
+
+ def ==(other)
+ eql?(other)
+ end
+
+ def eql?(other)
+ feature_config.feature == other.feature_config.feature and
+ variation.identifier == other.variation.identifier and
+ target.identifier == other.target.identifier
+ end
+
+ def hash
+ feature_config.feature.hash | variation.identifier.hash | target.identifier.hash
+ end
+
+
end
\ No newline at end of file