emmy-machine 0.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/emmy_machine/class_methods.rb +5 -1
- data/lib/emmy_machine/version.rb +1 -1
- data/spec/emmy_machine_spec.rb +13 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0ea555b9c2568da5263a9ccbe0feea6013c4f1a
|
4
|
+
data.tar.gz: e861446d73a10ec9818aaf8a339f053e396034e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daf765fdecbd9f039bc12253c59f081456b7a6047901bb5273f041d490d961182a5522edcb9a4e5b77898ab1e1aae0bdc7384bd266301c060c67304f445277d1
|
7
|
+
data.tar.gz: 25634015aeb42baad29c3a3d651a3a2147462e99c804e1c51319447b11a67462cdbcb3cba11f0a397a90ae3cea0ab5c564079c6970e4526f5f17c4f67a87f07d
|
@@ -17,7 +17,7 @@ module EmmyMachine
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def run_once &b
|
20
|
-
|
20
|
+
run do
|
21
21
|
async do
|
22
22
|
yield
|
23
23
|
stop
|
@@ -37,6 +37,10 @@ module EmmyMachine
|
|
37
37
|
pool.checkout &b
|
38
38
|
end
|
39
39
|
|
40
|
+
def await &b
|
41
|
+
Fiber.await &b
|
42
|
+
end
|
43
|
+
|
40
44
|
# Run the timer periodically
|
41
45
|
def timer(interval=1, &b)
|
42
46
|
EventMachine::PeriodicTimer.new(interval) do
|
data/lib/emmy_machine/version.rb
CHANGED
data/spec/emmy_machine_spec.rb
CHANGED
@@ -39,9 +39,20 @@ describe EmmyMachine do
|
|
39
39
|
|
40
40
|
context "The reactor is required" do
|
41
41
|
around do |example|
|
42
|
-
|
42
|
+
EmmyMachine.run do
|
43
43
|
example.run
|
44
|
-
|
44
|
+
EmmyMachine.stop
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "Async/await scenario" do
|
49
|
+
EmmyMachine.async do
|
50
|
+
res = EmmyMachine.await do |f|
|
51
|
+
EventMachine.next_tick do
|
52
|
+
f.resume 42
|
53
|
+
end
|
54
|
+
end
|
55
|
+
expect(res).to be(42)
|
45
56
|
end
|
46
57
|
end
|
47
58
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emmy-machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maksim V.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fibre
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: 2.3.0
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.6.6
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Cover EventMachine with fiber's sugar
|