Class: Ably::Rest::Channels

Inherits:
Object
  • Object
show all
Includes:
Modules::ChannelsCollection
Defined in:
lib/submodules/ably-ruby/lib/ably/rest/channels.rb

Instance Attribute Summary

Attributes included from Modules::ChannelsCollection

#length

Instance Method Summary collapse

Methods included from Modules::ChannelsCollection

#each

Constructor Details

#initialize(client) ⇒ Ably::Rest::Channels



7
8
9
# File 'lib/submodules/ably-ruby/lib/ably/rest/channels.rb', line 7

def initialize(client)
  super client, Ably::Rest::Channel
end

Instance Method Details

#fetch(name) {|options| ... } ⇒ Ably::Rest::Channel

Return a Ably::Rest::Channel for the given name if it exists, else the block will be called. This method is intentionally similar to Hash#fetch providing a simple way to check if a channel exists or not without creating one

Parameters:

  • name (String)

    The name of the channel

Yields:

  • (options)

    (optional) if a missing_block is passed to this method and no channel exists matching the name, this block is called

Yield Parameters:

  • name (String)

    of the missing channel

Returns:



29
30
31
# File 'lib/submodules/ably-ruby/lib/ably/rest/channels.rb', line 29

def fetch(*args)
  super
end

#get(name, channel_options = {}) ⇒ Ably::Rest::Channel

Return a Ably::Rest::Channel for the given name

Parameters:

  • name (String)

    The name of the channel

  • channel_options (Hash) (defaults to: {})

    Channel options, currently reserved for Encryption options

Returns:



17
18
19
# File 'lib/submodules/ably-ruby/lib/ably/rest/channels.rb', line 17

def get(*args)
  super
end

#release(*args) ⇒ void

This method returns an undefined value.

Destroy the Ably::Rest::Channel and releases the associated resources.

Releasing a Ably::Rest::Channel is not typically necessary as a channel consumes no resources other than the memory footprint of the Ably::Rest::Channel object. Explicitly release channels to free up resources if required



39
40
41
# File 'lib/submodules/ably-ruby/lib/ably/rest/channels.rb', line 39

def release(*args)
  super
end