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.
20 21 22 23 24 25 26 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 20 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))
10 11 12 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 10 def channel @channel end |
#mode ⇒ Object (readonly)
mode string (will be two or more characters matching: /^[\-][A-Za-z]
$/)
7 8 9 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 7 def mode @mode end |
#source ⇒ Object (readonly)
nick that applied the mode change
18 19 20 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 18 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
15 16 17 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 15 def target @target end |
Instance Method Details
#for_channel? ⇒ Boolean
If mode is for a channel
34 35 36 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 34 def for_channel? return @target.nil? end |
#for_nick? ⇒ Boolean
If mode is for a nick
29 30 31 |
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 29 def for_nick? return @channel.nil? end |