Class: Flexo::Events::KickEvent

Inherits:
Flexo::Event show all
Defined in:
lib/flexo/events/kick.rb

Instance Attribute Summary collapse

Attributes inherited from Flexo::Event

#data, #nickname

Instance Method Summary collapse

Methods inherited from Flexo::Event

#me?

Constructor Details

#initialize(*args) ⇒ KickEvent

Returns a new instance of KickEvent.



11
12
13
14
15
16
17
# File 'lib/flexo/events/kick.rb', line 11

def initialize(*args)
  super
  @kicker  = @data.hostmask.nick
  @channel = @data.params[0]
  @victim  = @data.params[1]
  @reason  = @data.string
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



4
5
6
# File 'lib/flexo/events/kick.rb', line 4

def channel
  @channel
end

#kickerObject (readonly) Also known as: kicked_by

Returns the value of attribute kicker.



5
6
7
# File 'lib/flexo/events/kick.rb', line 5

def kicker
  @kicker
end

#reasonObject (readonly)

Returns the value of attribute reason.



7
8
9
# File 'lib/flexo/events/kick.rb', line 7

def reason
  @reason
end

#victimObject (readonly)

Returns the value of attribute victim.



6
7
8
# File 'lib/flexo/events/kick.rb', line 6

def victim
  @victim
end

Instance Method Details

#kicked_me?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/flexo/events/kick.rb', line 19

def kicked_me?
  @victim == @manager.nickname
end

#rejoinObject



23
24
25
26
# File 'lib/flexo/events/kick.rb', line 23

def rejoin
  sleep rand*5
  @manager.sender.join(@channel)
end