Class: Botfly::CommonBlockAcceptor

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/botfly/common_block_acceptor.rb

Direct Known Subclasses

Bot, MUCClient

Defined Under Namespace

Classes: OnRecognizer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*ignored) ⇒ CommonBlockAcceptor

Returns a new instance of CommonBlockAcceptor.



7
8
9
10
# File 'lib/botfly/common_block_acceptor.rb', line 7

def initialize(*ignored)
  @block_state = {}
  @responders = {}
end

Instance Attribute Details

#block_stateObject (readonly)

Returns the value of attribute block_state.



5
6
7
# File 'lib/botfly/common_block_acceptor.rb', line 5

def block_state
  @block_state
end

#respondersObject (readonly)

Returns the value of attribute responders.



5
6
7
# File 'lib/botfly/common_block_acceptor.rb', line 5

def responders
  @responders
end

Instance Method Details

#[](key) ⇒ Object



16
17
18
# File 'lib/botfly/common_block_acceptor.rb', line 16

def [](key)
  @block_state[key]
end

#[]=(key, set_to) ⇒ Object



20
21
22
# File 'lib/botfly/common_block_acceptor.rb', line 20

def []=(key, set_to)
  @block_state[key] = set_to
end

#class_prefixObject



59
# File 'lib/botfly/common_block_acceptor.rb', line 59

def class_prefix; ''; end

#onObject



29
30
31
# File 'lib/botfly/common_block_acceptor.rb', line 29

def on
  return OnRecognizer.new(self)
end

#remove_responder(id_to_remove) ⇒ Object



24
25
26
27
# File 'lib/botfly/common_block_acceptor.rb', line 24

def remove_responder(id_to_remove)
  Botfly.logger.info("#{self.to_debug_s}: Removing responder #{id_to_remove}")
  @responders.each { |pair| key,chain = pair; chain.reject! {|r| r.id == id_to_remove } }
end

#respond_to(type, params) ⇒ Object



12
13
14
# File 'lib/botfly/common_block_acceptor.rb', line 12

def respond_to(type,params);  
  raise "AbstractMethodError: Implement in subclass" 
end

#to_debug_sObject



60
# File 'lib/botfly/common_block_acceptor.rb', line 60

def to_debug_s;   ''; end