Class: ChatBot::Main
- Inherits:
-
Object
- Object
- ChatBot::Main
- Defined in:
- lib/chatbot/main.rb
Instance Method Summary collapse
- #command(command, &block) ⇒ Object
- #configuration ⇒ Object
- #configure {|configuration| ... } ⇒ Object
-
#initialize ⇒ Main
constructor
A new instance of Main.
- #processMessage(rawMessage) ⇒ Object
Constructor Details
#initialize ⇒ Main
Returns a new instance of Main.
3 4 5 |
# File 'lib/chatbot/main.rb', line 3 def initialize @rule = {} end |
Instance Method Details
#command(command, &block) ⇒ Object
28 29 30 |
# File 'lib/chatbot/main.rb', line 28 def command(command, &block) @rule[command] = block end |
#configuration ⇒ Object
6 7 8 |
# File 'lib/chatbot/main.rb', line 6 def configuration @configuration ||= Configuration.new end |
#configure {|configuration| ... } ⇒ Object
10 11 12 |
# File 'lib/chatbot/main.rb', line 10 def configure yield(configuration) if block_given? end |
#processMessage(rawMessage) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/chatbot/main.rb', line 14 def processMessage(rawMessage) = GroupMeParser.parse(rawMessage) if .is_command? rule = find_rule(.command) unless rule.nil? = rule.call() unless .nil? () end end end return end |