Class: Botfly::CommonBlockAcceptor::OnRecognizer
- Inherits:
-
Object
- Object
- Botfly::CommonBlockAcceptor::OnRecognizer
- Defined in:
- lib/botfly/common_block_acceptor.rb
Instance Method Summary collapse
-
#initialize(obj) ⇒ OnRecognizer
constructor
A new instance of OnRecognizer.
- #method_missing(name, &block) ⇒ Object
Constructor Details
#initialize(obj) ⇒ OnRecognizer
Returns a new instance of OnRecognizer.
34 |
# File 'lib/botfly/common_block_acceptor.rb', line 34 def initialize(obj); @obj = obj; end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, &block) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/botfly/common_block_acceptor.rb', line 36 def method_missing(name,&block) @type = name Botfly.logger.info("#{@obj.to_debug_s}: Bot#on") (@obj.responders[name] ||= []) << responder = klass.new(@obj, &block) Botfly.logger.info("#{@obj.to_debug_s}: #{@obj.class_prefix}#{name.to_s.capitalize}Responder added to responder chain") return responder end |