Class: ModSpox::Messages::Incoming::Mode
- Defined in:
- lib/mod_spox/messages/incoming/Mode.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
mode channel (nil if target is nick (basically modes for the bot)).
-
#mode ⇒ Object
readonly
mode string (will be two or more characters matching: /^[
\-][A-Za-z]
$/). -
#source ⇒ Object
readonly
nick that applied the mode change.
-
#target ⇒ Object
readonly
nick mode is applied to (nil if mode change is for channel only) if multiple modes are applied to multiple nicks, this will be an array holding the nicks in order the mode string was applied.
Attributes inherited from Message
Instance Method Summary collapse
-
#for_channel? ⇒ Boolean
If mode is for a channel.
-
#for_nick? ⇒ Boolean
If mode is for a nick.
-
#initialize(raw, mode, source, target, channel) ⇒ Mode
constructor
A new instance of Mode.
Constructor Details
#initialize(raw, mode, source, target, channel) ⇒ Mode
Returns a new instance of Mode.
21 22 23 24 25 26 27 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 21 def initialize(raw, mode, source, target, channel) super(raw) @mode = mode @channel = channel @source = source @target = target end |
Instance Attribute Details
#channel ⇒ Object (readonly)
mode channel (nil if target is nick (basically modes for the bot))
11 12 13 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 11 def channel @channel end |
#mode ⇒ Object (readonly)
mode string (will be two or more characters matching: /^[\-][A-Za-z]
$/)
8 9 10 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 8 def mode @mode end |
#source ⇒ Object (readonly)
nick that applied the mode change
19 20 21 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 19 def source @source end |
#target ⇒ Object (readonly)
nick mode is applied to (nil if mode change is for channel only) if multiple modes are applied to multiple nicks, this will be an array holding the nicks in order the mode string was applied
16 17 18 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 16 def target @target end |
Instance Method Details
#for_channel? ⇒ Boolean
If mode is for a channel
35 36 37 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 35 def for_channel? return @target.nil? end |
#for_nick? ⇒ Boolean
If mode is for a nick
30 31 32 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 30 def for_nick? return @channel.nil? end |