Class: TamTam::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/tam_tam/message.rb

Overview

An individual message. Simple wrapper around a Hash with the message data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Message

Returns a new instance of Message.



7
8
9
# File 'lib/tam_tam/message.rb', line 7

def initialize(data)
  self.data = data
end

Instance Attribute Details

#data=(value) ⇒ Object

Sets the attribute data

Parameters:

  • value

    the value to set the attribute data to.



4
5
6
# File 'lib/tam_tam/message.rb', line 4

def data=(value)
  @data = value
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
# File 'lib/tam_tam/message.rb', line 23

def ==(other)
  data == other.data
end

#senderObject



11
12
13
# File 'lib/tam_tam/message.rb', line 11

def sender
  data[:sender]
end

#textObject



15
16
17
# File 'lib/tam_tam/message.rb', line 15

def text
  data[:text]
end

#timeObject



19
20
21
# File 'lib/tam_tam/message.rb', line 19

def time
  data[:time]
end