Class: AngryMob::Notifier
Instance Attribute Summary collapse
-
#mob ⇒ Object
Returns the value of attribute mob.
Instance Method Summary collapse
- #__predicate_to_lambda ⇒ Object
- #all?(&block) ⇒ Boolean
- #any?(&block) ⇒ Boolean
- #find(&block) ⇒ Object
- #for(nickname, options = {}, &block) ⇒ Object
-
#include_nickname?(nickname) ⇒ Boolean
queries.
-
#notifications ⇒ Object
The list of delayed targets.
-
#notify(notification) ⇒ Object
Handles a notification, by either placing it on the queue or calling it now.
- #schedule_notification(call) ⇒ Object
- #select(&block) ⇒ Object
- #ui ⇒ Object
Instance Attribute Details
#mob ⇒ Object
Returns the value of attribute mob
35 36 37 |
# File 'lib/angry_mob/notifier.rb', line 35 def mob @mob end |
Instance Method Details
#__predicate_to_lambda ⇒ Object
58 59 60 |
# File 'lib/angry_mob/notifier.rb', line 58 def __predicate_to_lambda() args = Target::Arguments.parse(*args) end |
#all?(&block) ⇒ Boolean
50 |
# File 'lib/angry_mob/notifier.rb', line 50 def all?(&block); notifications.all?(&block) end |
#any?(&block) ⇒ Boolean
49 |
# File 'lib/angry_mob/notifier.rb', line 49 def any?(&block); notifications.any?(&block) end |
#find(&block) ⇒ Object
48 |
# File 'lib/angry_mob/notifier.rb', line 48 def find(&block); notifications.find(&block) end |
#for(nickname, options = {}, &block) ⇒ Object
43 44 45 |
# File 'lib/angry_mob/notifier.rb', line 43 def for(nickname,={},&block) NotificationInspector.new(self,nickname,,&block) end |
#include_nickname?(nickname) ⇒ Boolean
queries
53 54 55 56 |
# File 'lib/angry_mob/notifier.rb', line 53 def include_nickname?(nickname) nickname = nickname.to_s notifications.any? {|n| n.target == nickname} end |
#notifications ⇒ Object
The list of delayed targets.
39 40 41 |
# File 'lib/angry_mob/notifier.rb', line 39 def notifications @notifications ||= [] end |
#notify(notification) ⇒ Object
Handles a notification, by either placing it on the queue or calling it now
63 64 65 66 67 68 69 |
# File 'lib/angry_mob/notifier.rb', line 63 def notify(notification) if AngryMob::Target::Notify === notification notifications << notification elsif Proc === notification notification[mob] end end |
#schedule_notification(call) ⇒ Object
71 72 73 |
# File 'lib/angry_mob/notifier.rb', line 71 def schedule_notification(call) notifications << call end |
#select(&block) ⇒ Object
47 |
# File 'lib/angry_mob/notifier.rb', line 47 def select(&block); notifications.select(&block) end |
#ui ⇒ Object
36 |
# File 'lib/angry_mob/notifier.rb', line 36 def ui; mob.ui end |