Class: IRC::RFC2812::Message

Inherits:
Message
  • Object
show all
Defined in:
lib/irc/rfc2812/message.rb

Instance Attribute Summary

Attributes inherited from Message

#command, #params, #prefix, #raw, #time, #trail

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

#==, #=~, #initialize, #match, #strip_colors

Constructor Details

This class inherits a constructor from IRC::Message

Class Method Details

.parse(raw_message) ⇒ Object



7
8
9
# File 'lib/irc/rfc2812/message.rb', line 7

def self.parse(raw_message)
  Helpers.parse raw_message
end

Instance Method Details

#error?Boolean

Public: Checks if the message is an error reply according to RFC2812.

Returns:

  • (Boolean)


21
22
23
# File 'lib/irc/rfc2812/message.rb', line 21

def error?
  self.numeric? && ERROR_REPLY_RANGE.cover?(self.command)
end

#numeric?Boolean

Public: Checks if the message is a numeric reply.

Returns:

  • (Boolean)


16
17
18
# File 'lib/irc/rfc2812/message.rb', line 16

def numeric?
  self.command =~ /^\d+$/
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/irc/rfc2812/message.rb', line 11

def valid?
  Helpers.valid? self.raw
end