ruby_events 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/ruby_events.rb +3 -3
- metadata +3 -3
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ require 'rake/testtask'
|
|
12
12
|
|
13
13
|
spec = Gem::Specification.new do |s|
|
14
14
|
s.name = 'ruby_events'
|
15
|
-
s.version = '0.0.
|
15
|
+
s.version = '0.0.6'
|
16
16
|
s.has_rdoc = true
|
17
17
|
s.extra_rdoc_files = ['README.markdown']
|
18
18
|
s.summary = 'A really simple event implementation that hooks into the Object class. Now all your objects can join in the fun of firing events!'
|
data/lib/ruby_events.rb
CHANGED
@@ -15,7 +15,7 @@ module RubyEvents
|
|
15
15
|
|
16
16
|
# Add a listener to the passed event type.
|
17
17
|
def listen(event_type, &event)
|
18
|
-
@events[event_type] = [] unless event_is_defined
|
18
|
+
@events[event_type] = [] unless event_is_defined(event_type)
|
19
19
|
# TODO: Can we allow both block and an array of Proc's here?
|
20
20
|
@events[event_type] << event
|
21
21
|
end
|
@@ -25,7 +25,7 @@ module RubyEvents
|
|
25
25
|
def fire(event_type, *arguments)
|
26
26
|
@events[event_type].each do |event|
|
27
27
|
event.call arguments
|
28
|
-
end if event_is_defined
|
28
|
+
end if event_is_defined(event_type)
|
29
29
|
end
|
30
30
|
|
31
31
|
# Set an event to fire when passed method is called. This is useful for
|
@@ -55,7 +55,7 @@ module RubyEvents
|
|
55
55
|
|
56
56
|
# Remove a method from the listening queue.
|
57
57
|
def remove(event_type, event)
|
58
|
-
@events[event_type].delete_if {|stored_event| stored_event == event} if event_is_defined
|
58
|
+
@events[event_type].delete_if {|stored_event| stored_event == event} if event_is_defined(event_type)
|
59
59
|
end
|
60
60
|
|
61
61
|
private
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Nathan Kleyn
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-11 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|