class Rollout::Logging::Event
Attributes
context[R]
created_at[R]
data[R]
feature[R]
name[R]
Public Class Methods
from_raw(value, score)
click to toggle source
# File lib/rollout/logging.rb, line 19 def self.from_raw(value, score) hash = JSON.parse(value, symbolize_names: true) new(**hash.merge(created_at: Time.at(-score.to_f / 1_000_000))) end
new(feature: nil, name:, data:, context: {}, created_at:)
click to toggle source
# File lib/rollout/logging.rb, line 25 def initialize(feature: nil, name:, data:, context: {}, created_at:) @feature = feature @name = name @data = data @context = context @created_at = created_at end
Public Instance Methods
==(other)
click to toggle source
# File lib/rollout/logging.rb, line 46 def ==(other) feature == other.feature \ && name == other.name \ && data == other.data \ && created_at == other.created_at end
serialize()
click to toggle source
# File lib/rollout/logging.rb, line 37 def serialize JSON.dump( feature: @feature, name: @name, data: @data, context: @context, ) end
timestamp()
click to toggle source
# File lib/rollout/logging.rb, line 33 def timestamp (@created_at.to_f * 1_000_000).to_i end