Class: Cinch::Plugins::AntiSpam::Abuser

Inherits:
Object
  • Object
show all
Defined in:
lib/cinch/plugins/anti_spam.rb

Defined Under Namespace

Classes: Current

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAbuser


18
19
20
21
# File 'lib/cinch/plugins/anti_spam.rb', line 18

def initialize
  @kick_count = 0
  @current = Current.new(Time.now, Time.now, nil, 1)
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current


10
11
12
# File 'lib/cinch/plugins/anti_spam.rb', line 10

def current
  @current
end

#kick_countObject (readonly)

Returns the value of attribute kick_count


10
11
12
# File 'lib/cinch/plugins/anti_spam.rb', line 10

def kick_count
  @kick_count
end

Instance Method Details

#delete_current_and_increment_kick_count!Object


32
33
34
# File 'lib/cinch/plugins/anti_spam.rb', line 32

def delete_current_and_increment_kick_count!
  @kick_count, @current = @kick_count.succ, nil
end

#increment_current!Object


23
24
25
26
# File 'lib/cinch/plugins/anti_spam.rb', line 23

def increment_current!
  @current.increment_count!
  @current.last_offence = Time.now
end

#reset_current!Object


28
29
30
# File 'lib/cinch/plugins/anti_spam.rb', line 28

def reset_current!
  @current = Current.new(Time.now, Time.now, nil, 1)
end