class Faye::Channel
Constants
- CONNECT
- DISCONNECT
- HANDSHAKE
- META
- SERVICE
- SUBSCRIBE
- UNSUBSCRIBE
Attributes
Public Class Methods
Source
# File lib/faye/protocol/channel.rb, line 30 def expand(name) segments = parse(name) channels = ['/**', name] copy = segments.dup copy[copy.size - 1] = '*' channels << unparse(copy) 1.upto(segments.size - 1) do |i| copy = segments[0...i] copy << '**' channels << unparse(copy) end channels end
Source
# File lib/faye/protocol/channel.rb, line 61 def meta?(name) segments = parse(name) segments ? (segments.first == META) : nil end
Source
# File lib/faye/protocol/channel.rb, line 7 def initialize(name) super() @name = name end
Calls superclass method
Source
# File lib/faye/protocol/channel.rb, line 52 def parse(name) return nil unless valid?(name) name.split('/')[1..-1] end
Source
# File lib/faye/protocol/channel.rb, line 66 def service?(name) segments = parse(name) segments ? (segments.first == SERVICE) : nil end
Source
# File lib/faye/protocol/channel.rb, line 71 def subscribable?(name) return nil unless valid?(name) not meta?(name) and not service?(name) end
Source
# File lib/faye/protocol/channel.rb, line 57 def unparse(segments) '/' + segments.join('/') end
Source
# File lib/faye/protocol/channel.rb, line 47 def valid?(name) Grammar::CHANNEL_NAME =~ name or Grammar::CHANNEL_PATTERN =~ name end
Public Instance Methods
Source
# File lib/faye/protocol/channel.rb, line 12 def <<(message) trigger(:message, message) end
Source
# File lib/faye/protocol/channel.rb, line 16 def unused? listener_count(:message).zero? end