event-framework 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/event-framework.rb +17 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08ea584cdc07a46121cc42f48de72b45df0c3d6a
|
4
|
+
data.tar.gz: 7c46006e80b9acf330ab5ff81cc85e600227aa29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a89345595abf2fd2e9e85693eeb579e460bae744e81d7668315b32fd95424a70c47d5d8f9087ee18f3167df9af2e1c964e3dace8ed209568cfcb05a199434853
|
7
|
+
data.tar.gz: 0e021be365fd459e2d74afaec1b9e8b23beb09349aa7ae8127b356e74a9d822f37b85762b3d101bee4ddfdfbac281bb155eb08408812c9fa842620f3c5fb0af0
|
data/lib/event-framework.rb
CHANGED
@@ -40,6 +40,7 @@
|
|
40
40
|
# === Notices
|
41
41
|
#
|
42
42
|
# * EF::Object should be included after initialize
|
43
|
+
# * Also you may admix EF::Object methods and needed instance variables by extending: `Object.new.extend(EF::Object)`
|
43
44
|
# * Callbacks will be executed in threads of subscribers (where they were defined)
|
44
45
|
# * In the example the handler will be called in the main thread, <br> but if you define the client in the thread where you bind it to the server's event, <br> then the handler will be called in the same thread
|
45
46
|
module EF
|
@@ -103,6 +104,10 @@ module EF
|
|
103
104
|
##
|
104
105
|
# patches initialize to admix needed variables
|
105
106
|
def self.included(base)
|
107
|
+
return if base.respond_to? :ef
|
108
|
+
|
109
|
+
def base.ef; end
|
110
|
+
|
106
111
|
base.class_exec do
|
107
112
|
alias alias_initialize initialize
|
108
113
|
|
@@ -121,6 +126,17 @@ module EF
|
|
121
126
|
end
|
122
127
|
end
|
123
128
|
|
129
|
+
##
|
130
|
+
# allows you to extend any object
|
131
|
+
# obj = Object.new
|
132
|
+
# obj.extend EF::Object
|
133
|
+
def self.extended(base)
|
134
|
+
base.instance_variable_set :@mutex, Mutex.new
|
135
|
+
base.instance_variable_set :@thread, Thread.current
|
136
|
+
base.instance_variable_set :@observers, []
|
137
|
+
base.instance_variable_set :@observables, []
|
138
|
+
end
|
139
|
+
|
124
140
|
##
|
125
141
|
# returns the thread where the object was defined
|
126
142
|
def thread
|
@@ -186,7 +202,7 @@ module EF
|
|
186
202
|
if (!observable || o == observable) && (!event || e == event) && (!block || b == block)
|
187
203
|
if self == o
|
188
204
|
@observers.reject! do |o, e, b|
|
189
|
-
o == self
|
205
|
+
o == self
|
190
206
|
end
|
191
207
|
else
|
192
208
|
o.unregistrate(self, e, b)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event-framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Speransky Danil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Event Framework is a minimalistic library providing publish–subscribe
|
14
14
|
pattern
|