Class: IRC::Client::Server
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#clients ⇒ Object
readonly
Returns the value of attribute clients.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nick ⇒ Object
Returns the value of attribute nick.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
Instance Method Summary collapse
-
#initialize(client, socket, config, name = nil) ⇒ Server
constructor
A new instance of Server.
- #raw(text) ⇒ Object
- #send(symbol, *args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(client, socket, config, name = nil) ⇒ Server
Returns a new instance of Server.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/failirc/client/server.rb', line 31 def initialize (client, socket, config, name=nil) @client = client @socket = socket @config = config @channels = Channels.new(self) @clients = Clients.new(self) @host = socket.peeraddr[2] @ip = socket.peeraddr[3] @port = socket.peeraddr[1] nick = client.nick if !name name = @host else if client.server name raise Error.new "There is already a server named `#{name}`." end end while client.server name name << '_' end @name = name end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def channels @channels end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def client @client end |
#clients ⇒ Object (readonly)
Returns the value of attribute clients.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def clients @clients end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def config @config end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def host @host end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def ip @ip end |
#name ⇒ Object
Returns the value of attribute name.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def name @name end |
#nick ⇒ Object
Returns the value of attribute nick.
29 30 31 |
# File 'lib/failirc/client/server.rb', line 29 def nick @nick end |
#password ⇒ Object
Returns the value of attribute password.
29 30 31 |
# File 'lib/failirc/client/server.rb', line 29 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def port @port end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
28 29 30 |
# File 'lib/failirc/client/server.rb', line 28 def socket @socket end |
Instance Method Details
#raw(text) ⇒ Object
77 78 79 80 |
# File 'lib/failirc/client/server.rb', line 77 def raw (text) @client.dispatcher.dispatch :output, self, text @client.dispatcher.connection.output.push @socket, text end |
#send(symbol, *args) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/failirc/client/server.rb', line 69 def send (symbol, *args) begin self.method(symbol).call(*args) rescue Exception => e self.debug e end end |
#to_s ⇒ Object
82 83 84 |
# File 'lib/failirc/client/server.rb', line 82 def to_s name end |