lib/botfly/common_block_acceptor.rb in botfly-0.3.0 vs lib/botfly/common_block_acceptor.rb in botfly-0.3.1

- old
+ new

@@ -3,11 +3,11 @@ extend Forwardable attr_accessor :responders attr_reader :client - def initialize(ignored,ignore) + def initialize(jid,pass,opts={}) @block_state = {} @responders = {} end ABSTRACT_RAISE_ERROR = "AbstractMethodError: Implement in subclass" @@ -35,10 +35,11 @@ class OnRecognizer def initialize(obj); @obj = obj; end def method_missing(type,&block) Botfly.logger.info("#{@obj.to_debug_s}: Bot#on") - klass = Botfly.const_get(@obj.class_prefix + type.to_s.capitalize + "Responder") + type_name = type.to_s.split('_').map(&:capitalize).join('') + klass = Botfly.const_get(@obj.class_prefix + type_name + "Responder") (@obj.responders[type] ||= []) << responder = klass.new(@obj, &block) Botfly.logger.info("#{@obj.to_debug_s}: #{@obj.class_prefix}#{type.to_s.capitalize}Responder added to responder chain") return responder end end \ No newline at end of file