Class: CeilingCat::Plugin::TWSS

Inherits:
Base
  • Object
show all
Defined in:
lib/ceiling_cat/plugins/twss.rb

Constant Summary collapse

RESPONSES =
["That's what she said!", "Uh, that's what she said!", "TWSS", "TWSS!"]

Class Attribute Summary collapse

Attributes inherited from Base

#event

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#body, #body_without_command, #body_without_nick, #body_without_nick_or_command, commands, #commands, #initialize, #pluralize, #reply, #room, store, #store, #user, #words

Constructor Details

This class inherits a constructor from CeilingCat::Plugin::Base

Class Attribute Details

.thresholdObject

Returns the value of attribute threshold.



6
7
8
# File 'lib/ceiling_cat/plugins/twss.rb', line 6

def threshold
  @threshold
end

Class Method Details

.descriptionObject



16
17
18
# File 'lib/ceiling_cat/plugins/twss.rb', line 16

def self.description
  "TWSS via Bayes classifier"
end

.nameObject



20
21
22
# File 'lib/ceiling_cat/plugins/twss.rb', line 20

def self.name
  "TWSS"
end

.public?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/ceiling_cat/plugins/twss.rb', line 24

def self.public?
  false
end

Instance Method Details

#handleObject



9
10
11
12
13
14
# File 'lib/ceiling_cat/plugins/twss.rb', line 9

def handle
  TWSS.threshold = self.class.threshold
  if event.type == :chat && TWSS(body)
    reply RESPONSES[Kernel.rand(RESPONSES.size)]
  end
end