Module: Ably::Modules::Encodeable
- Defined in:
- lib/ably/modules/encodeable.rb
Overview
Provides methods to allow this model’s ‘data` property to be encoded and decoded based on the `encoding` property.
This module expects the following:
-
A #attributes method that returns the underlying hash object
-
A #set_attributes_object(attributes) method that updates the underlying hash object
-
A #raw_hash_object attribute that returns the original hash object used to create this object
Instance Method Summary collapse
-
#decode(channel) ⇒ void
private
Decode a message using the channel options and registered encoders for the client.
-
#encode(channel) ⇒ void
private
Encode a message using the channel options and register encoders for the client.
-
#original_encoding ⇒ String?
private
The original encoding of this message when it was received as a raw message from the Ably service.
Instance Method Details
#decode(channel) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Decode a message using the channel options and registered encoders for the client
25 26 27 |
# File 'lib/ably/modules/encodeable.rb', line 25 def decode(channel) apply_encoders :decode, channel end |
#encode(channel) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Encode a message using the channel options and register encoders for the client
17 18 19 |
# File 'lib/ably/modules/encodeable.rb', line 17 def encode(channel) apply_encoders :encode, channel end |
#original_encoding ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The original encoding of this message when it was received as a raw message from the Ably service
32 33 34 |
# File 'lib/ably/modules/encodeable.rb', line 32 def original_encoding raw_hash_object['encoding'] end |