/
publish_event.rb
42 lines (36 loc) · 1 KB
/
publish_event.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true
class PublishEvent
attr_accessor :hashed, :units, :published_at, :exposures, :goals, :attributes
def initialize
@published_at = 0
@hashed = false
end
def ==(o)
return true if self.object_id == o.object_id
return false if o.nil? || self.class != o.class
that = o
@hashed == that.hashed && @units == that.units &&
@published_at == that.published_at && @exposures == that.exposures &&
@goals == that.goals && @attributes == that.attributes
end
def hash_code
{
hashed: @hashed,
units: @units,
published_at: @published_at,
exposures: @exposures,
goals: @goals,
attributes: @attributes
}
end
def to_s
"PublishEvent{" +
"hashedUnits=#{@hashed}" +
", units=#{@units.inspect}" +
", publishedAt=#{@published_at}" +
", exposures=#{@exposures.inspect}" +
", goals=#{@goals.inspect}" +
", attributes=#{@attributes!=nil ? @attributes.join : ""}" +
"}"
end
end