Class: ModSpox::Messages::Incoming::Mode

Inherits:
Message
  • Object
show all
Defined in:
lib/mod_spox/messages/incoming/Mode.rb

Instance Attribute Summary collapse

Attributes inherited from Message

#raw_content, #time

Instance Method Summary collapse

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

#channelObject (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

#modeObject (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

#sourceObject (readonly)

nick that applied the mode change



18
19
20
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 18

def source
  @source
end

#targetObject (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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


29
30
31
# File 'lib/mod_spox/messages/incoming/Mode.rb', line 29

def for_nick?
    return @channel.nil?
end