Sha256: 76fb6f415d5240dec58ac980267db7d7d694c7a2e6713907ef2984a7d6382806

Contents?: true

Size: 674 Bytes

Versions: 6

Compression:

Stored size: 674 Bytes

Contents

class Net::IRC::Message::ServerConfig
  attr_reader :mode_parser

  def initialize
    @config = {}
    @mode_parser = Net::IRC::Message::ModeParser.new
  end

  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

  def [](key)
    @config[key]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
net-irc2-0.0.15 lib/net/irc/message/serverconfig.rb
net-irc2-0.0.14 lib/net/irc/message/serverconfig.rb
net-irc2-0.0.13 lib/net/irc/message/serverconfig.rb
net-irc2-0.0.12 lib/net/irc/message/serverconfig.rb
net-irc2-0.0.11 lib/net/irc/message/serverconfig.rb
net-irc2-0.0.10 lib/net/irc/message/serverconfig.rb