class Net::IRC::Message::ServerConfig

Attributes

mode_parser[R]

Public Class Methods

new() click to toggle source
  # File lib/net/irc/message/serverconfig.rb
4 def initialize
5         @config = {}
6         @mode_parser = Net::IRC::Message::ModeParser.new
7 end

Public Instance Methods

[](key) click to toggle source
   # File lib/net/irc/message/serverconfig.rb
27 def [](key)
28         @config[key]
29 end
set(arg) click to toggle source
   # File lib/net/irc/message/serverconfig.rb
 9 def set(arg)
10         params = arg.kind_of?(Net::IRC::Message) ? arg.to_a : arg.split(" ")
11 
12         params[1..-1].each do |s|
13                 case s
14                 when /\A:?are supported by this server\z/
15                         # Ignore
16                 when /\A([^=]+)=(.*)\z/
17                         key = Regexp.last_match[1].to_sym
18                         value = Regexp.last_match[2]
19                         @config[key] = value
20                         @mode_parser.set(key, value) if key == :CHANMODES || key == :PREFIX
21                 else
22                         @config[s] = true
23                 end
24         end
25 end