Class: Wiki

Inherits:
Cogibara::OperatorBase show all
Defined in:
lib/cogibara/operators/wiki.rb

Instance Attribute Summary

Attributes inherited from Cogibara::OperatorBase

#clientID, #message_structure, #message_text, #operator_config

Instance Method Summary collapse

Methods inherited from Cogibara::OperatorBase

#confirm, #initialize, #process_file, #receive_message, #say

Constructor Details

This class inherits a constructor from Cogibara::OperatorBase

Instance Method Details

#initialize_operatorObject



5
6
7
# File 'lib/cogibara/operators/wiki.rb', line 5

def initialize_operator
  @handler = WikiGetter.new
end

#process(message) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cogibara/operators/wiki.rb', line 9

def process(message)
  search = message.text
  article = WikiGetter.new.getArticle(search)
  # splits = article.split
  # (splits.count / 100).times do |n|
  #     if (n+1)*100 > splits.count
  #       chunk = splits[n*100..splits.count] * ' '
  #     else
  #       chunk = splits[n*100..((n+1)*100 - 1)] * ' '
  #     end
  #     yield chunk
  #   end
end