Class: Protocol::WebSocket::Message
- Inherits:
-
Object
- Object
- Protocol::WebSocket::Message
- Defined in:
- lib/protocol/websocket/message.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
Instance Method Summary collapse
-
#==(other) ⇒ Object
This can be helpful for writing tests.
- #encoding ⇒ Object
-
#initialize(buffer) ⇒ Message
constructor
A new instance of Message.
- #size ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(buffer) ⇒ Message
Returns a new instance of Message.
11 12 13 |
# File 'lib/protocol/websocket/message.rb', line 11 def initialize(buffer) @buffer = buffer end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
15 16 17 |
# File 'lib/protocol/websocket/message.rb', line 15 def buffer @buffer end |
Instance Method Details
#==(other) ⇒ Object
This can be helpful for writing tests.
22 23 24 |
# File 'lib/protocol/websocket/message.rb', line 22 def == other @buffer == other.to_str end |
#encoding ⇒ Object
30 31 32 |
# File 'lib/protocol/websocket/message.rb', line 30 def encoding @buffer.encoding end |
#size ⇒ Object
17 18 19 |
# File 'lib/protocol/websocket/message.rb', line 17 def size @buffer.bytesize end |
#to_str ⇒ Object
26 27 28 |
# File 'lib/protocol/websocket/message.rb', line 26 def to_str @buffer end |