Class: Prpr::Handler::Base
- Inherits:
-
Object
- Object
- Prpr::Handler::Base
- Defined in:
- lib/prpr/handler/base.rb
Defined Under Namespace
Classes: Entry
Constant Summary collapse
- AnyEvent =
Object
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(event) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(event) ⇒ Base
Returns a new instance of Base.
43 44 45 |
# File 'lib/prpr/handler/base.rb', line 43 def initialize(event) @event = event end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
42 43 44 |
# File 'lib/prpr/handler/base.rb', line 42 def event @event end |
Class Method Details
.entries ⇒ Object
14 15 16 |
# File 'lib/prpr/handler/base.rb', line 14 def entries @@entries ||= [] end |
.handle(event, queries = {}, &handler) ⇒ Object
10 11 12 |
# File 'lib/prpr/handler/base.rb', line 10 def handle(event, queries = {}, &handler) entries << Entry.new(self, event, queries, handler) end |
.on_event(event) ⇒ Object
18 19 20 21 22 |
# File 'lib/prpr/handler/base.rb', line 18 def on_event(event) entries .select { |entry| match?(entry, event) } .each { |entry| invoke(entry, event) } end |