Class: Roflbot::SentenceBot
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #generated_message ⇒ Object
-
#initialize(*args) ⇒ SentenceBot
constructor
A new instance of SentenceBot.
Methods inherited from Base
#expects, #on_im, #respond_via_sms, #respond_via_twitter, #start, #stop, #wait
Constructor Details
#initialize(*args) ⇒ SentenceBot
Returns a new instance of SentenceBot.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/roflbot/sentence_bot.rb', line 5 def initialize(*args) super parser = SentenceParser.new @sentences = [] @options["sentences"].each do |sentence| node = parser.parse(sentence) @sentences << node end self.expects(/^.*$/).responds { } end |
Instance Method Details
#generated_message ⇒ Object
16 17 18 19 |
# File 'lib/roflbot/sentence_bot.rb', line 16 def node = @sentences[rand(@sentences.length)] node.to_s(@options) end |