Class: Ably::Rest::Channels

Inherits:
Object
  • Object
show all
Includes:
Modules::ChannelsCollection
Defined in:
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/ably/rest/channels.rb', line 7

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

Instance Method Details

#fetch(*args) {|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:



31
32
33
# File 'lib/ably/rest/channels.rb', line 31

def fetch(*args)
  super
end

#get(*args) ⇒ Ably::Rest::Channel

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

Parameters:

  • name (String)

    The name of the channel

  • channel_options (Hash)

    Channel options, currently reserved for Encryption options

Returns:



18
19
20
# File 'lib/ably/rest/channels.rb', line 18

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



42
43
44
# File 'lib/ably/rest/channels.rb', line 42

def release(*args)
  super
end