Class: WebSocketMessageFormat
- Inherits:
-
Format
- Object
- Format
- WebSocketMessageFormat
- Defined in:
- lib/websocketmessageformat.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
- #export ⇒ Object
-
#initialize(content, binary = false) ⇒ WebSocketMessageFormat
constructor
A new instance of WebSocketMessageFormat.
- #name ⇒ Object
Constructor Details
#initialize(content, binary = false) ⇒ WebSocketMessageFormat
14 15 16 17 |
# File 'lib/websocketmessageformat.rb', line 14 def initialize(content, binary=false) @content = content @binary = binary end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
12 13 14 |
# File 'lib/websocketmessageformat.rb', line 12 def content @content end |
Instance Method Details
#export ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/websocketmessageformat.rb', line 23 def export out = Hash.new if @binary out['content-bin'] = Base64.encode64(@content) else out['content'] = @content end return out end |
#name ⇒ Object
19 20 21 |
# File 'lib/websocketmessageformat.rb', line 19 def name return 'ws-message' end |