ruby_events 1.0.2 → 1.1.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ruby_events.rb +16 -2
- metadata +11 -8
data/lib/ruby_events.rb
CHANGED
@@ -9,7 +9,7 @@ module RubyEvents
|
|
9
9
|
class Events
|
10
10
|
# The current version of RubyEvents.
|
11
11
|
def self.version
|
12
|
-
'1.0.
|
12
|
+
'1.1.0.beta'
|
13
13
|
end
|
14
14
|
|
15
15
|
# Initialize the events class by instantiating the class methods we'll be
|
@@ -69,7 +69,7 @@ module RubyEvents
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
else
|
72
|
-
raise
|
72
|
+
raise 'The given object does not respond to method you are trying to intercept calls to.'
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -77,6 +77,20 @@ module RubyEvents
|
|
77
77
|
def remove(event_type, event)
|
78
78
|
@events[event_type].delete_if {|stored_event| stored_event == event} if event_is_defined(event_type)
|
79
79
|
end
|
80
|
+
|
81
|
+
# Remove a fire on method alias event.
|
82
|
+
def remove_fire_on_method(method)
|
83
|
+
parent, old_method = @parent, ('ruby_events_' + method.to_s + '_event_old').to_sym
|
84
|
+
parent.class.class_eval do
|
85
|
+
if parent.respond_to?(old_method, true)
|
86
|
+
remove_method method
|
87
|
+
alias_method method, old_method
|
88
|
+
public method
|
89
|
+
else
|
90
|
+
raise 'The fire on method trigger you were trying to remove does not exist.'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
80
94
|
|
81
95
|
private
|
82
96
|
# Checks if an event of event_type is defined in the collection of events.
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31098201
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
10
|
+
- beta
|
11
|
+
version: 1.1.0.beta
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Nathan Kleyn
|
@@ -52,12 +53,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
54
|
none: false
|
54
55
|
requirements:
|
55
|
-
- - "
|
56
|
+
- - ">"
|
56
57
|
- !ruby/object:Gem::Version
|
57
|
-
hash:
|
58
|
+
hash: 25
|
58
59
|
segments:
|
59
|
-
-
|
60
|
-
|
60
|
+
- 1
|
61
|
+
- 3
|
62
|
+
- 1
|
63
|
+
version: 1.3.1
|
61
64
|
requirements: []
|
62
65
|
|
63
66
|
rubyforge_project:
|