Class: IRCSupport::Message
- Inherits:
-
Object
- Object
- IRCSupport::Message
- Defined in:
- lib/ircsupport/message.rb
Direct Known Subclasses
CAP, ChannelModeChange, DCC, Error, Invite, Join, Kick, Message, Nick, Numeric, Part, Ping, Quit, ServerNotice, Topic, UserModeChange
Defined Under Namespace
Classes: CAP, CTCP, CTCPReply, ChannelModeChange, DCC, Error, Invite, Join, Kick, Message, Nick, Numeric, Numeric005, Numeric352, Numeric353, Part, Ping, Quit, ServerNotice, Topic, UserModeChange
Instance Attribute Summary collapse
-
#args ⇒ Array
The arguments to the IRC command.
-
#command ⇒ String
The IRC command.
-
#prefix ⇒ String
The sender prefix of the IRC message, if any.
Instance Method Summary collapse
-
#initialize(args) ⇒ Message
constructor
A new instance of Message.
-
#type ⇒ String
The type of the IRC message.
Constructor Details
#initialize(args) ⇒ Message
Returns a new instance of Message.
17 18 19 20 21 |
# File 'lib/ircsupport/message.rb', line 17 def initialize(args) @prefix = args[:prefix] @command = args[:command] @args = args[:args] end |
Instance Attribute Details
#args ⇒ Array
Returns The arguments to the IRC command.
14 15 16 |
# File 'lib/ircsupport/message.rb', line 14 def args @args end |
#command ⇒ String
Returns The IRC command.
11 12 13 |
# File 'lib/ircsupport/message.rb', line 11 def command @command end |
#prefix ⇒ String
Returns The sender prefix of the IRC message, if any.
8 9 10 |
# File 'lib/ircsupport/message.rb', line 8 def prefix @prefix end |
Instance Method Details
#type ⇒ String
Returns The type of the IRC message.
24 25 26 27 28 29 |
# File 'lib/ircsupport/message.rb', line 24 def type return @type if @type return @command.downcase.to_sym if self.class.name == 'IRCSupport::Message' type = self.class.name.match(/^IRCSupport::Message::(.*)/)[1] return type.gsub(/::|(?<=[[:lower:]])(?=[[:upper:]])/, '_').downcase.to_sym end |