Class: Warchat::Network::Response
- Inherits:
-
Hash
- Object
- Hash
- Warchat::Network::Response
- Defined in:
- lib/warchat/network/response.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#length ⇒ Object
Returns the value of attribute length.
-
#status ⇒ Object
Returns the value of attribute status.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(socket, *args) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #ok? ⇒ Boolean
Constructor Details
#initialize(socket, *args) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/warchat/network/response.rb', line 6 def initialize socket,*args super *args reader = BinaryReader.new socket self.length = reader.int_32 self.status = reader.int_16 self.target = reader.string self.id = reader.int_32 merge! reader.parse_next end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/warchat/network/response.rb', line 5 def id @id end |
#length ⇒ Object
Returns the value of attribute length.
5 6 7 |
# File 'lib/warchat/network/response.rb', line 5 def length @length end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/warchat/network/response.rb', line 5 def status @status end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/warchat/network/response.rb', line 5 def target @target end |
Instance Method Details
#inspect ⇒ Object
21 22 23 |
# File 'lib/warchat/network/response.rb', line 21 def inspect "<#{self.class.name} id:#{id.inspect} target:#{target.inspect} status:#{status.inspect} #{super}>" end |
#ok? ⇒ Boolean
17 18 19 |
# File 'lib/warchat/network/response.rb', line 17 def ok? status == 200 end |