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



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

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

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

#sourceObject (readonly)

nick that applied the mode change



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

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



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