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) ⇒ WebSocketMessageFormat
constructor
A new instance of WebSocketMessageFormat.
- #name ⇒ Object
Constructor Details
#initialize(content) ⇒ WebSocketMessageFormat
Returns a new instance of WebSocketMessageFormat.
14 15 16 |
# File 'lib/websocketmessageformat.rb', line 14 def initialize(content) @content = content 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
22 23 24 25 26 27 28 29 30 |
# File 'lib/websocketmessageformat.rb', line 22 def export out = Hash.new if @content.encoding.name == 'ASCII-8BIT' out['content-bin'] = Base64.encode64(@content) else out['content'] = @content end return out end |
#name ⇒ Object
18 19 20 |
# File 'lib/websocketmessageformat.rb', line 18 def name return 'ws-message' end |