Class: Hahamut::Message::Base
Overview
Instance Attribute Summary collapse
#attributes
Class Method Summary
collapse
Instance Method Summary
collapse
#assign_attributes, included
Constructor Details
#initialize(attributes, sender_id = nil) ⇒ Base
TODO: Improve sender / recipient setup
18
19
20
21
|
# File 'lib/hahamut/message/base.rb', line 18
def initialize(attributes, sender_id = nil)
assign_attributes(attributes)
@sender_id = sender_id
end
|
Instance Attribute Details
#sender_id ⇒ Object
Returns the value of attribute sender_id.
15
16
17
|
# File 'lib/hahamut/message/base.rb', line 15
def sender_id
@sender_id
end
|
Class Method Details
.match?(_message) ⇒ Boolean
8
9
10
|
# File 'lib/hahamut/message/base.rb', line 8
def match?(_message)
false
end
|
Instance Method Details
#as_json(_obj = nil) ⇒ Object
27
28
29
|
# File 'lib/hahamut/message/base.rb', line 27
def as_json(_obj = nil)
@attributes.dup.merge(type: type)
end
|
#to_json(_obj = nil) ⇒ Object
31
32
33
|
# File 'lib/hahamut/message/base.rb', line 31
def to_json(_obj = nil)
as_json.to_json
end
|
#type ⇒ Object
23
24
25
|
# File 'lib/hahamut/message/base.rb', line 23
def type
raise NotImplementedError
end
|