Class: Bender::Processor::AutoHelp

Inherits:
BaseProcessor show all
Defined in:
processors/auto_help.rb

Overview

Description

dynamically generates and prints help

Dependencies

none

Configuration

none

Authors

Michael Heijmans ([email protected])

Instance Attribute Summary

Attributes inherited from BaseProcessor

#bot, #command, #msg, #origin, #room

Instance Method Summary collapse

Methods inherited from BaseProcessor

#call, #directly_addressed?, #hear, #initialize, #reply, #respond, #should_process?

Constructor Details

This class inherits a constructor from Bender::BaseProcessor

Instance Method Details

#help_messagesObject


21
22
23
24
25
26
# File 'processors/auto_help.rb', line 21

def help_messages
  Bender::Processor.constants.each_with_object([]) do |const, ary|
    klass = "Bender::Processor::#{const.to_s}".classify
    ary << klass.help if klass.respond_to?(:help)
  end.flatten
end

#processObject


15
16
17
18
19
# File 'processors/auto_help.rb', line 15

def process
  respond(/help$/i) do
    help_messages.each { |msg| reply msg }
  end
end