Class: Rodent::Base
- Inherits:
-
Object
- Object
- Rodent::Base
- Defined in:
- lib/rodent/base.rb
Class Attribute Summary collapse
-
.error_handler ⇒ Object
Returns the value of attribute error_handler.
-
.instance ⇒ Object
readonly
Returns the value of attribute instance.
-
.listeners ⇒ Object
readonly
Returns the value of attribute listeners.
Class Method Summary collapse
Class Attribute Details
.error_handler ⇒ Object
Returns the value of attribute error_handler.
5 6 7 |
# File 'lib/rodent/base.rb', line 5 def error_handler @error_handler end |
.instance ⇒ Object (readonly)
Returns the value of attribute instance.
4 5 6 |
# File 'lib/rodent/base.rb', line 4 def instance @instance end |
.listeners ⇒ Object (readonly)
Returns the value of attribute listeners.
4 5 6 |
# File 'lib/rodent/base.rb', line 4 def listeners @listeners end |
Class Method Details
.bind ⇒ Object
22 23 24 25 26 |
# File 'lib/rodent/base.rb', line 22 def bind listeners.each do |listener| listener.bind(error_handler) end end |
.listen(type, &block) ⇒ Object
18 19 20 |
# File 'lib/rodent/base.rb', line 18 def listen(type, &block) listeners << Rodent::Listener.new(type, &block) end |
.route(type) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rodent/base.rb', line 11 def route(type) @listeners.each do |listener| return listener if type == listener.type end nil end |