Class: Cakewalk::Network
- Inherits:
-
Object
- Object
- Cakewalk::Network
- Defined in:
- lib/cakewalk/network.rb
Overview
This class allows querying the IRC network for its name and used server software as well as certain non-standard behaviour.
Instance Attribute Summary collapse
-
#capabilities ⇒ Array<Symbol>
network.
-
#ircd ⇒ Symbol
The server software used by the network.
-
#name ⇒ Symbol
The name of the network.
Instance Method Summary collapse
-
#default_messages_per_second ⇒ Numeric
The
messages per second
value that best suits the current network. -
#default_server_queue_size ⇒ Integer
The
server queue size
value that best suits the current network. -
#initialize(name, ircd) ⇒ Network
constructor
private
A new instance of Network.
-
#owner_list_mode ⇒ String?
The mode used for getting the list of channel owners, if any.
-
#quiet_list_mode ⇒ String?
The mode used for getting the list of channel quiets, if any.
-
#unknown_ircd? ⇒ Boolean
True if we do not know which software the server is running.
-
#unknown_network? ⇒ Boolean
True if we do not know which network we are connected to.
Constructor Details
#initialize(name, ircd) ⇒ Network
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The user should not create instances of this class but use IRC#network instead.
Returns a new instance of Network.
33 34 35 36 37 |
# File 'lib/cakewalk/network.rb', line 33 def initialize(name, ircd) @name = name @ircd = ircd @capabilities = [] end |
Instance Attribute Details
#capabilities ⇒ Array<Symbol>
network.
23 24 25 |
# File 'lib/cakewalk/network.rb', line 23 def capabilities @capabilities end |
#ircd ⇒ Symbol
Returns The server software used by the network.
:unknown
if the software couldn’t be detected.
16 17 18 |
# File 'lib/cakewalk/network.rb', line 16 def ircd @ircd end |
#name ⇒ Symbol
Returns The name of the network. :unknown
if the
network couldn’t be detected.
9 10 11 |
# File 'lib/cakewalk/network.rb', line 9 def name @name end |
Instance Method Details
#default_messages_per_second ⇒ Numeric
Returns The messages per second
value that best suits
the current network.
69 70 71 72 73 74 75 76 |
# File 'lib/cakewalk/network.rb', line 69 def case @name when :freenode 0.7 else 0.5 end end |
#default_server_queue_size ⇒ Integer
Returns The server queue size
value that best suits
the current network.
80 81 82 83 84 85 86 87 |
# File 'lib/cakewalk/network.rb', line 80 def default_server_queue_size case @name when :quakenet 40 else 10 end end |
#owner_list_mode ⇒ String?
Returns The mode used for getting the list of channel owners, if any.
41 42 43 |
# File 'lib/cakewalk/network.rb', line 41 def owner_list_mode return "q" if @ircd == :unreal || @ircd == :inspircd end |
#quiet_list_mode ⇒ String?
Returns The mode used for getting the list of channel quiets, if any.
47 48 49 |
# File 'lib/cakewalk/network.rb', line 47 def quiet_list_mode return "q" if @ircd == :"ircd-seven" end |
#unknown_ircd? ⇒ Boolean
Returns True if we do not know which software the server is running.
59 60 61 |
# File 'lib/cakewalk/network.rb', line 59 def unknown_ircd? @ircd == :unknown end |
#unknown_network? ⇒ Boolean
Returns True if we do not know which network we are connected to.
53 54 55 |
# File 'lib/cakewalk/network.rb', line 53 def unknown_network? @name == :unknown end |