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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3ad3e71202672a3562713e1c85ad47e4b7739e0
4
- data.tar.gz: 9724037ad6dc9153cbaff317d6d70427fed2205a
3
+ metadata.gz: c0ea555b9c2568da5263a9ccbe0feea6013c4f1a
4
+ data.tar.gz: e861446d73a10ec9818aaf8a339f053e396034e6
5
5
  SHA512:
6
- metadata.gz: 7738f684fdb57e1d6e66b1a3eaa75c94a680722c0fa21fbde8bb4f2f761de848c24613223b63d619deb77c0a82a6ff2c9015bfbc4b468d186501a6a63a1f8f9f
7
- data.tar.gz: 216c025ed2df64ad558de270ea96fdfd6b93e774d51152e52e0bba659048cbb070efb96a54a3f4cb62a00f62104a1e323d9dfdd066e35aa802023fc0ee35c4af
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
- EventMachine.run do
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
@@ -1,3 +1,3 @@
1
1
  module EmmyMachine
2
- VERSION = "0.4"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -39,9 +39,20 @@ describe EmmyMachine do
39
39
 
40
40
  context "The reactor is required" do
41
41
  around do |example|
42
- EventMachine.run do
42
+ EmmyMachine.run do
43
43
  example.run
44
- EventMachine.stop
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: '0.4'
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-10 00:00:00.000000000 Z
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.5.1
137
+ rubygems_version: 2.6.6
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Cover EventMachine with fiber's sugar