Class: Net::IRC::Message::ServerConfig
- Inherits:
-
Object
- Object
- Net::IRC::Message::ServerConfig
- Defined in:
- lib/net/irc/message/serverconfig.rb
Instance Attribute Summary collapse
-
#mode_parser ⇒ Object
readonly
Returns the value of attribute mode_parser.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize ⇒ ServerConfig
constructor
A new instance of ServerConfig.
- #set(arg) ⇒ Object
Constructor Details
#initialize ⇒ ServerConfig
Returns a new instance of ServerConfig.
4 5 6 7 |
# File 'lib/net/irc/message/serverconfig.rb', line 4 def initialize @config = {} @mode_parser = Net::IRC::Message::ModeParser.new end |
Instance Attribute Details
#mode_parser ⇒ Object (readonly)
Returns the value of attribute mode_parser.
2 3 4 |
# File 'lib/net/irc/message/serverconfig.rb', line 2 def mode_parser @mode_parser end |
Instance Method Details
#[](key) ⇒ Object
27 28 29 |
# File 'lib/net/irc/message/serverconfig.rb', line 27 def [](key) @config[key] end |
#set(arg) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/net/irc/message/serverconfig.rb', line 9 def set(arg) params = arg.kind_of?(Net::IRC::Message) ? arg.to_a : arg.split(" ") params[1..-1].each do |s| case s when /\A:?are supported by this server\z/ # Ignore when /\A([^=]+)=(.*)\z/ key = Regexp.last_match[1].to_sym value = Regexp.last_match[2] @config[key] = value @mode_parser.set(key, value) if key == :CHANMODES || key == :PREFIX else @config[s] = true end end end |