class IRCParser::Message

Public: Represents an IRC message.

Attributes

command[R]

Public: Command name (e.g. PRIVMSG).

parameters[R]

Public: An array of command parameters.

prefix[R]

Public: The prefix of this command or nil if unprefixed.

tags[R]

Public: A hash of IRCv3 message tags.

Public Class Methods

new(command: String.new, parameters: Array.new, prefix: nil, tags: Hash.new) click to toggle source

Public: Initializes a new message.

command - Command name (e.g. PRIVMSG). parameters - An array of command parameters. prefix - The prefix of this command or nil if unprefixed. tags - A hash of IRCv3 message tags.

# File lib/ircparser/message.rb, line 39
def initialize command: String.new, parameters: Array.new, prefix: nil, tags: Hash.new
        @command    = command
        @parameters = parameters
        @prefix     = prefix
        @tags       = tags
end
parse(line) click to toggle source

Public: Parses an IRC message from wire form.

line - The line to attempt to parse.

# File lib/ircparser/message.rb, line 49
def self.parse line
        return IRCParser::RFCWireFormat.objectify line
end

Public Instance Methods

to_s() click to toggle source

Public: Serializes the message to a string.

# File lib/ircparser/message.rb, line 54
def to_s
        return IRCParser::RFCWireFormat.stringify self
end