Class: Skype::OS::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/skype/os/notifier.rb

Instance Method Summary collapse

Instance Method Details

#add(reg, block = Proc.new) ⇒ Object



8
9
10
# File 'lib/skype/os/notifier.rb', line 8

def add reg, block=Proc.new
  notify[reg] = block
end

#del(reg) ⇒ Object



12
13
14
# File 'lib/skype/os/notifier.rb', line 12

def del reg
  notify.delete reg
end

#fire(res) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/skype/os/notifier.rb', line 16

def fire res
  objects_notify_fire = false
  notify.each do |reg, action|
    if res =~ reg
      action.call($1)
      objects_notify_fire = true
    end
  end

  unless objects_notify_fire
    notify[nil].call(res) if notify[nil]
  end
end

#notifyObject



4
5
6
# File 'lib/skype/os/notifier.rb', line 4

def notify
  @notify ||= Hash.new
end