Class Net::IRC::Message::ServerConfig
In: lib/net/irc/message/serverconfig.rb
Parent: Object

Methods

[]   new   set  

Attributes

mode_parser  [R] 

Public Class methods

[Source]

   # File lib/net/irc/message/serverconfig.rb, line 4
4:         def initialize
5:                 @config = {}
6:                 @mode_parser = Net::IRC::Message::ModeParser.new
7:         end

Public Instance methods

[Source]

    # File lib/net/irc/message/serverconfig.rb, line 27
27:         def [](key)
28:                 @config[key]
29:         end

[Source]

    # File lib/net/irc/message/serverconfig.rb, line 9
 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

[Validate]