Class: Gsm::Incoming

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygsm/msg/incoming.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device, sender, sent, text) ⇒ Incoming

Returns a new instance of Incoming.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rubygsm/msg/incoming.rb', line 8

def initialize(device, sender, sent, text)
	
	# move all arguments into read-only
	# attributes. ugly, but Struct only
	# supports read/write attrs
	@device = device
	@sender = sender
	@sent = sent
	@text = text
	
	# assume that the message was
	# received right now, since we
	# don't have an incoming buffer
	@received = Time.now
end

Instance Attribute Details

#deviceObject (readonly)

Returns the value of attribute device.



6
7
8
# File 'lib/rubygsm/msg/incoming.rb', line 6

def device
  @device
end

#receivedObject (readonly)

Returns the value of attribute received.



6
7
8
# File 'lib/rubygsm/msg/incoming.rb', line 6

def received
  @received
end

#senderObject (readonly)

Returns the value of attribute sender.



6
7
8
# File 'lib/rubygsm/msg/incoming.rb', line 6

def sender
  @sender
end

#sentObject (readonly)

Returns the value of attribute sent.



6
7
8
# File 'lib/rubygsm/msg/incoming.rb', line 6

def sent
  @sent
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/rubygsm/msg/incoming.rb', line 6

def text
  @text
end

Instance Method Details

#numberObject

Returns the sender of this message, so incoming and outgoing messages can be logged in the same way.



27
28
29
# File 'lib/rubygsm/msg/incoming.rb', line 27

def number
	sender
end