Class: Ably::Models::MessageEncoders::Base64
- Defined in:
- lib/submodules/ably-ruby/lib/ably/models/message_encoders/base64.rb
Overview
Base64 binary Encoder and Decoder Uses encoding identifier 'base64'
Constant Summary collapse
- ENCODING_ID =
'base64'
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
20 21 22 23 24 25 |
# File 'lib/submodules/ably-ruby/lib/ably/models/message_encoders/base64.rb', line 20 def decode(, ) if is_base64_encoded?() [:data] = ::Base64.decode64([:data]) strip_current_encoding_part end end |
#encode(message, channel_options) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/submodules/ably-ruby/lib/ably/models/message_encoders/base64.rb', line 11 def encode(, ) return if is_empty?() if is_binary?() && transport_protocol_text? [:data] = ::Base64.encode64([:data]) ENCODING_ID, end end |