Class: UDPRest::UDPPacket
- Inherits:
-
Object
- Object
- UDPRest::UDPPacket
- Defined in:
- lib/udp_rest/udp.rb
Instance Attribute Summary collapse
-
#addr_family ⇒ Object
Returns the value of attribute addr_family.
-
#src_addr ⇒ Object
Returns the value of attribute src_addr.
-
#src_port ⇒ Object
Returns the value of attribute src_port.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(data = nil) ⇒ UDPPacket
constructor
A new instance of UDPPacket.
- #to_s ⇒ Object
Constructor Details
#initialize(data = nil) ⇒ UDPPacket
Returns a new instance of UDPPacket.
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/udp_rest/udp.rb', line 55 def initialize(data = nil) # assume this was initialized with the standard data structure # that is returned by UDPSocket if !data.nil? self.text = data[0] self.addr_family = data[1][0] self.src_port = data[1][1] self.src_addr = data[1][2] end end |
Instance Attribute Details
#addr_family ⇒ Object
Returns the value of attribute addr_family.
51 52 53 |
# File 'lib/udp_rest/udp.rb', line 51 def addr_family @addr_family end |
#src_addr ⇒ Object
Returns the value of attribute src_addr.
53 54 55 |
# File 'lib/udp_rest/udp.rb', line 53 def src_addr @src_addr end |
#src_port ⇒ Object
Returns the value of attribute src_port.
52 53 54 |
# File 'lib/udp_rest/udp.rb', line 52 def src_port @src_port end |
#text ⇒ Object
Returns the value of attribute text.
50 51 52 |
# File 'lib/udp_rest/udp.rb', line 50 def text @text end |
Instance Method Details
#to_s ⇒ Object
66 67 68 |
# File 'lib/udp_rest/udp.rb', line 66 def to_s self.text end |