Class: Ably::Models::MessageEncoders::Utf8
- Defined in:
- lib/ably/models/message_encoders/utf8.rb
Overview
Utf8 Encoder and Decoder Uses encoding identifier ‘utf-8’ and encodes all JSON objects as UTF-8, and sets the encoding when decoding
Constant Summary collapse
- ENCODING_ID =
'utf-8'
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#add_encoding_to_message, #current_encoding_part, #initialize, #is_empty?, #strip_current_encoding_part
Constructor Details
This class inherits a constructor from Ably::Models::MessageEncoders::Base
Instance Method Details
#decode(message, channel_options) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/ably/models/message_encoders/utf8.rb', line 14 def decode(, ) if is_utf8_encoded?() [:data] = [:data].force_encoding(Encoding::UTF_8) strip_current_encoding_part end end |
#encode(message, channel_options) ⇒ Object
10 11 12 |
# File 'lib/ably/models/message_encoders/utf8.rb', line 10 def encode(, ) # no encoding of UTF-8 required end |