Class: Nl::NotificationStream
- Inherits:
-
Object
- Object
- Nl::NotificationStream
- Includes:
- Enumerable
- Defined in:
- nl/lib/nl/notification.rb
Overview
An unbounded-in-time, single-family view of unsolicited messages.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(&receive) ⇒ NotificationStream
constructor
A new instance of NotificationStream.
- #next(timeout: nil) ⇒ Object
Constructor Details
#initialize(&receive) ⇒ NotificationStream
Returns a new instance of NotificationStream.
96 97 98 |
# File 'nl/lib/nl/notification.rb', line 96 def initialize(&receive) @receive = receive end |
Instance Method Details
#each ⇒ Object
106 107 108 109 110 |
# File 'nl/lib/nl/notification.rb', line 106 def each return enum_for(__method__) unless block_given? loop { yield self.next } end |
#next(timeout: nil) ⇒ Object
100 101 102 |
# File 'nl/lib/nl/notification.rb', line 100 def next(timeout: nil) @receive.call(timeout) end |