Skip to content
This repository has been archived by the owner on Feb 12, 2018. It is now read-only.

Commit

Permalink
Condensed some more code
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel committed Jan 17, 2010
1 parent cb818af commit 7235cdf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ class Provider

# Create a new provider.
def initialize(domain, subdomain='wave', sock=nil)
subdomain = "#{subdomain}." if subdomain

@domain = domain
@name = "#{subdomain}#{domain}"
@servers = ServerList.new
@name = [subdomain, domain] * '.'
@servers = ServerList.new self
@sock = sock
@packet_ids = {}
@ready = false

@servers.provider = self

@local = Server.new self, @domain, @name, false
@local.state = :local
Expand Down
5 changes: 5 additions & 0 deletions lib/server_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ module Sails
class ServerList < Hash
attr_accessor :provider

def initialize provider=nil
super()
@provider = provider
end

def [](server)
return nil unless server
super server.downcase
Expand Down

0 comments on commit 7235cdf

Please sign in to comment.