Sha256: 652e479784b9861e1aa7b9325754beae916020d838371ec5fe6662962a314f37

Contents?: true

Size: 453 Bytes

Versions: 13

Compression:

Stored size: 453 Bytes

Contents

class ServerList < Array
  def at(index)
    if index.is_a? String
      select do |server|
        server.endpoint == index
      end
    else
      super
    end
  end

  def <<(server)
    if at(server.endpoint).size == 0
      super
    else
      raise ArgumentError, "Server at mount point #{server.endpoint} is already present."
    end
  end
  alias push <<

  def clear!
    self.each do |server|
      server.stop
    end
    clear
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
faye-rails-2.0.3 lib/faye-rails/server_list.rb
faye-rails-2.0.1 lib/faye-rails/server_list.rb
faye-rails-2.0.0 lib/faye-rails/server_list.rb
faye-rails-1.0.10 lib/faye-rails/server_list.rb
faye-rails-1.0.8 lib/faye-rails/server_list.rb
faye-rails-1.0.7 lib/faye-rails/server_list.rb
faye-rails-1.0.6 lib/faye-rails/server_list.rb
faye-rails-1.0.5 lib/faye-rails/server_list.rb
faye-rails-1.0.4 lib/faye-rails/server_list.rb
faye-rails-1.0.3 lib/faye-rails/server_list.rb
faye-rails-1.0.2 lib/faye-rails/server_list.rb
faye-rails-1.0.1 lib/faye-rails/server_list.rb
faye-rails-1.0.0 lib/faye-rails/server_list.rb