Class: Botfly::CommonBlockAcceptor
- Inherits:
-
Object
- Object
- Botfly::CommonBlockAcceptor
- Extended by:
- Forwardable
- Defined in:
- lib/botfly/common_block_acceptor.rb
Defined Under Namespace
Classes: OnRecognizer
Instance Attribute Summary collapse
-
#block_state ⇒ Object
readonly
Returns the value of attribute block_state.
-
#responders ⇒ Object
readonly
Returns the value of attribute responders.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, set_to) ⇒ Object
- #class_prefix ⇒ Object
-
#initialize(*ignored) ⇒ CommonBlockAcceptor
constructor
A new instance of CommonBlockAcceptor.
- #on ⇒ Object
- #remove_responder(id_to_remove) ⇒ Object
- #respond_to(type, params) ⇒ Object
- #to_debug_s ⇒ Object
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_state ⇒ Object (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 |
#responders ⇒ Object (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_prefix ⇒ Object
59 |
# File 'lib/botfly/common_block_acceptor.rb', line 59 def class_prefix; ''; end |
#on ⇒ Object
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_s ⇒ Object
60 |
# File 'lib/botfly/common_block_acceptor.rb', line 60 def to_debug_s; ''; end |