Module: Ably::Models::MessageEncoders
- Extended by:
- Ably::Modules::Conversions
- Defined in:
- lib/submodules/ably-ruby/lib/ably/models/message_encoders/base.rb,
lib/submodules/ably-ruby/lib/ably/models/message_encoders/json.rb,
lib/submodules/ably-ruby/lib/ably/models/message_encoders/utf8.rb,
lib/submodules/ably-ruby/lib/ably/models/message_encoders/base64.rb,
lib/submodules/ably-ruby/lib/ably/models/message_encoders/cipher.rb
Defined Under Namespace
Classes: Base, Base64, Cipher, Json, Utf8
Class Method Summary collapse
- .encoder_from(encoder, options) ⇒ Object private
- .register_default_encoders(client, options = {}) ⇒ Object private
Class Method Details
.encoder_from(encoder, options) ⇒ Object
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.
110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/submodules/ably-ruby/lib/ably/models/message_encoders/base.rb', line 110 def self.encoder_from(encoder, ) encoder_klass = if encoder.kind_of?(String) encoder.split('::').inject(Kernel) do |base, klass_name| base.public_send(:const_get, klass_name) end else encoder end raise "Encoder must inherit from `Ably::Models::MessageEncoders::Base`" unless encoder_klass.ancestors.include?(Ably::Models::MessageEncoders::Base) encoder_klass.new(self, ) end |
.register_default_encoders(client, options = {}) ⇒ Object
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.
101 102 103 104 105 106 107 |
# File 'lib/submodules/ably-ruby/lib/ably/models/message_encoders/base.rb', line 101 def self.register_default_encoders(client, = {}) binary_protocol = !![:binary_protocol] client.register_encoder Ably::Models::MessageEncoders::Utf8 client.register_encoder Ably::Models::MessageEncoders::Json client.register_encoder Ably::Models::MessageEncoders::Cipher client.register_encoder Ably::Models::MessageEncoders::Base64, binary_protocol: binary_protocol end |