Sha256: 7b02accc1631bb6fe1f616a746d5cda32fbd4ea17735b21f38d9146f230ea469

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 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

2 entries across 2 versions & 1 rubygems

Version Path
net-irc-0.0.9 lib/net/irc/message/serverconfig.rb
net-irc-0.0.8 lib/net/irc/message/serverconfig.rb