Class: AngryMob::Notifier

Inherits:
Struct
  • Object
show all
Defined in:
lib/angry_mob/notifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mobObject

Returns the value of attribute mob

Returns:

  • (Object)

    the current value of mob



35
36
37
# File 'lib/angry_mob/notifier.rb', line 35

def mob
  @mob
end

Instance Method Details

#__predicate_to_lambdaObject



58
59
60
# File 'lib/angry_mob/notifier.rb', line 58

def __predicate_to_lambda()
  args = Target::Arguments.parse(*args)
end

#all?(&block) ⇒ Boolean

Returns:

  • (Boolean)


50
# File 'lib/angry_mob/notifier.rb', line 50

def all?(&block); notifications.all?(&block) end

#any?(&block) ⇒ Boolean

Returns:

  • (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,options={},&block)
  NotificationInspector.new(self,nickname,options,&block)
end

#include_nickname?(nickname) ⇒ Boolean

queries

Returns:

  • (Boolean)


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

#notificationsObject

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

#uiObject



36
# File 'lib/angry_mob/notifier.rb', line 36

def ui; mob.ui end