Class: EventObject::Array

Inherits:
Object
  • Object
show all
Defined in:
lib/event/array.rb

Instance Method Summary collapse

Instance Method Details

#fire(*a, &b) ⇒ Object

array like event



4
5
6
# File 'lib/event/array.rb', line 4

def fire(*a, &b)
  each { |h| h.call(*a, &b) }
end

#fire_for(t, *a) ⇒ Object



8
9
10
# File 'lib/event/array.rb', line 8

def fire_for(t, *a)
  each { |h| t.instance_exec(*a, &h) }
end

#off(proc = nil) ⇒ Object



12
13
14
# File 'lib/event/array.rb', line 12

def off(proc=nil)
  (proc) ? delete(proc) : clear
end