em-wrapper 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +52 -10
- data/LICENSE.txt +1 -1
- data/README.md +20 -29
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/em-wrapper.gemspec +61 -0
- data/lib/em-wrapper.rb +2 -4
- metadata +24 -54
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aa57b34c5de49ba30619484d171f86cb93524bc1
|
4
|
+
data.tar.gz: 20fabf7db0b68d5dbbbd1efa9b8a53eae466522f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3e377440d52928712e04bd54c5df422568a83b8829a4b681e2fe5fe56f4af6f4c73ae9cde321271687694749db6c03447699229a82e4be981d40aa14b1092f41
|
7
|
+
data.tar.gz: b21fe0f41fe28081b361860dd754e5e880fc2a7e5d11b753ac5e13487bee4b1da7c48c2b14420aa9e4eb1aa4bb5bf5790960f2cf31d34b4ae2d9eb7d6dedffe4
|
data/Gemfile
CHANGED
@@ -2,13 +2,12 @@ source "http://rubygems.org"
|
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
gem "object-proxy", ">= 0.3.0"
|
5
|
-
gem "hash-utils", ">= 0.17.0"
|
6
5
|
gem "eventmachine", ">= 0"
|
7
6
|
|
8
7
|
# Add dependencies to develop your gem here.
|
9
8
|
# Include everything needed to run rake, tests, features, etc.
|
10
9
|
group :development do
|
11
10
|
gem "bundler", ">= 1.0.0"
|
12
|
-
gem "
|
11
|
+
gem "jeweler", ">= 1.5.2"
|
13
12
|
gem "riot", ">= 0.12.3"
|
14
13
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,58 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
addressable (2.3.8)
|
5
|
+
builder (3.2.2)
|
6
|
+
descendants_tracker (0.0.4)
|
7
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
8
|
+
eventmachine (1.0.7)
|
9
|
+
faraday (0.9.1)
|
10
|
+
multipart-post (>= 1.2, < 3)
|
11
|
+
git (1.2.9.1)
|
12
|
+
github_api (0.12.3)
|
13
|
+
addressable (~> 2.3)
|
14
|
+
descendants_tracker (~> 0.0.4)
|
15
|
+
faraday (~> 0.8, < 0.10)
|
16
|
+
hashie (>= 3.3)
|
17
|
+
multi_json (>= 1.7.5, < 2.0)
|
18
|
+
nokogiri (~> 1.6.3)
|
19
|
+
oauth2
|
20
|
+
hash-utils (2.2.0)
|
21
|
+
ruby-version (>= 0.4.0)
|
22
|
+
hashie (3.4.2)
|
23
|
+
highline (1.7.2)
|
24
|
+
jeweler (2.0.1)
|
25
|
+
builder
|
26
|
+
bundler (>= 1.0)
|
9
27
|
git (>= 1.2.5)
|
28
|
+
github_api
|
29
|
+
highline (>= 1.6.15)
|
30
|
+
nokogiri (>= 1.5.10)
|
31
|
+
rake
|
32
|
+
rdoc
|
33
|
+
jwt (1.5.1)
|
34
|
+
mini_portile (0.6.2)
|
35
|
+
multi_json (1.11.2)
|
36
|
+
multi_xml (0.5.5)
|
37
|
+
multipart-post (2.0.0)
|
38
|
+
nokogiri (1.6.6.2)
|
39
|
+
mini_portile (~> 0.6.0)
|
40
|
+
oauth2 (1.0.0)
|
41
|
+
faraday (>= 0.8, < 0.10)
|
42
|
+
jwt (~> 1.0)
|
43
|
+
multi_json (~> 1.3)
|
44
|
+
multi_xml (~> 0.5)
|
45
|
+
rack (~> 1.2)
|
10
46
|
object-proxy (0.3.0)
|
11
47
|
hash-utils (>= 0.12.1)
|
12
|
-
|
48
|
+
rack (1.6.4)
|
49
|
+
rake (10.4.2)
|
50
|
+
rdoc (4.2.0)
|
51
|
+
riot (0.12.7)
|
13
52
|
rr
|
14
|
-
rr (1.
|
15
|
-
ruby-version (0.3
|
53
|
+
rr (1.1.2)
|
54
|
+
ruby-version (0.4.3)
|
55
|
+
thread_safe (0.3.5)
|
16
56
|
|
17
57
|
PLATFORMS
|
18
58
|
ruby
|
@@ -20,7 +60,9 @@ PLATFORMS
|
|
20
60
|
DEPENDENCIES
|
21
61
|
bundler (>= 1.0.0)
|
22
62
|
eventmachine
|
23
|
-
|
24
|
-
jeweler2 (>= 2.0.0)
|
63
|
+
jeweler (>= 1.5.2)
|
25
64
|
object-proxy (>= 0.3.0)
|
26
65
|
riot (>= 0.12.3)
|
66
|
+
|
67
|
+
BUNDLED WITH
|
68
|
+
1.10.5
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -11,43 +11,34 @@ work as expected and as is usuall.
|
|
11
11
|
|
12
12
|
See some example:
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
```ruby
|
15
|
+
require "em-wrapper"
|
16
|
+
require "eventmachine"
|
17
|
+
|
18
|
+
class Foo
|
19
|
+
def foo
|
20
|
+
yield :foo
|
21
|
+
return :bar
|
22
22
|
end
|
23
|
-
|
24
|
-
wrapped = EM::Wrapper::new(Foo)::new
|
25
|
-
EM::run do
|
26
|
-
p wrapped.foo { |value| # 1. will print :bar out
|
27
|
-
p value # 2. will be run in next EM tick, will print :foo out
|
28
|
-
}
|
29
|
-
end
|
23
|
+
end
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
3. Commit your changes (`git commit -am "Added something"`).
|
40
|
-
4. Push to the branch (`git push origin 20101220-my-change`).
|
41
|
-
5. Create an [Issue][9] with a link to your branch.
|
42
|
-
6. Enjoy a refreshing Diet Coke and wait.
|
25
|
+
wrapped = EM::Wrapper::new(Foo)::new
|
26
|
+
EM::run do
|
27
|
+
p wrapped.foo { |value| # 1. will print :bar out
|
28
|
+
p value # 2. will be run in next EM
|
29
|
+
# tick, will print :foo out
|
30
|
+
}
|
31
|
+
end
|
32
|
+
```
|
43
33
|
|
34
|
+
Also object wrapping is supported. In that case, simply give object instance instead of class object to the constructor. Wrapped object instance will be returned.
|
44
35
|
|
45
36
|
Copyright
|
46
37
|
---------
|
47
38
|
|
48
|
-
Copyright © 2011 [Martin
|
39
|
+
Copyright © 2011 – 2015 [Martin Poljak][10]. See `LICENSE.txt` for
|
49
40
|
further details.
|
50
41
|
|
51
42
|
[8]: http://rubyeventmachine.com/
|
52
43
|
[9]: http://github.com/martinkozak/em-wrapper/issues
|
53
|
-
[10]: http://www.
|
44
|
+
[10]: http://www.martinpoljak.net/
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ rescue Bundler::BundlerError => e
|
|
11
11
|
end
|
12
12
|
|
13
13
|
require 'rake'
|
14
|
-
require '
|
14
|
+
require 'jeweler'
|
15
15
|
|
16
16
|
Jeweler::Tasks.new do |gem|
|
17
17
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
@@ -19,8 +19,8 @@ Jeweler::Tasks.new do |gem|
|
|
19
19
|
gem.homepage = "http://github.com/martinkozak/em-wrapper"
|
20
20
|
gem.license = "MIT"
|
21
21
|
gem.summary = "Wraps objects callbacks to EventMachine next ticks, so allows transparent multiplexing of objects which aren't multiplexable by default."
|
22
|
-
gem.email = "
|
23
|
-
gem.authors = ["Martin
|
22
|
+
gem.email = "martin@poljak.cz"
|
23
|
+
gem.authors = ["Martin Poljak"]
|
24
24
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
25
25
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
26
26
|
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/em-wrapper.gemspec
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: em-wrapper 0.1.1 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "em-wrapper"
|
9
|
+
s.version = "0.1.1"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Martin Poljak"]
|
14
|
+
s.date = "2015-07-19"
|
15
|
+
s.email = "martin@poljak.cz"
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"em-wrapper.gemspec",
|
29
|
+
"lib/em-wrapper.rb",
|
30
|
+
"test"
|
31
|
+
]
|
32
|
+
s.homepage = "http://github.com/martinkozak/em-wrapper"
|
33
|
+
s.licenses = ["MIT"]
|
34
|
+
s.rubygems_version = "2.4.5"
|
35
|
+
s.summary = "Wraps objects callbacks to EventMachine next ticks, so allows transparent multiplexing of objects which aren't multiplexable by default."
|
36
|
+
|
37
|
+
if s.respond_to? :specification_version then
|
38
|
+
s.specification_version = 4
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
+
s.add_runtime_dependency(%q<object-proxy>, [">= 0.3.0"])
|
42
|
+
s.add_runtime_dependency(%q<eventmachine>, [">= 0"])
|
43
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
44
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
|
45
|
+
s.add_development_dependency(%q<riot>, [">= 0.12.3"])
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<object-proxy>, [">= 0.3.0"])
|
48
|
+
s.add_dependency(%q<eventmachine>, [">= 0"])
|
49
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
50
|
+
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
51
|
+
s.add_dependency(%q<riot>, [">= 0.12.3"])
|
52
|
+
end
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<object-proxy>, [">= 0.3.0"])
|
55
|
+
s.add_dependency(%q<eventmachine>, [">= 0"])
|
56
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
57
|
+
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
58
|
+
s.add_dependency(%q<riot>, [">= 0.12.3"])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
data/lib/em-wrapper.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# (c) 2011 Martin
|
2
|
+
# (c) 2011 - 2015 Martin Poljak (martin@poljak.cz)
|
3
3
|
|
4
|
-
require "hash-utils/object"
|
5
4
|
require "object-proxy"
|
6
5
|
require "eventmachine"
|
7
6
|
|
@@ -34,7 +33,7 @@ module EM
|
|
34
33
|
object.wrapped.send(name, *args) do |result|
|
35
34
|
if not block.nil?
|
36
35
|
EM::next_tick do
|
37
|
-
result = [result] if not result.
|
36
|
+
result = [result] if not result.kind_of? Array
|
38
37
|
block.call(*result)
|
39
38
|
end
|
40
39
|
end
|
@@ -55,4 +54,3 @@ module EM
|
|
55
54
|
|
56
55
|
end
|
57
56
|
end
|
58
|
-
|
metadata
CHANGED
@@ -1,156 +1,126 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
- Martin
|
7
|
+
- Martin Poljak
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: object-proxy
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.3.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.3.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: hash-utils
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 0.17.0
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 0.17.0
|
46
27
|
- !ruby/object:Gem::Dependency
|
47
28
|
name: eventmachine
|
48
29
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
30
|
requirements:
|
51
|
-
- -
|
31
|
+
- - ">="
|
52
32
|
- !ruby/object:Gem::Version
|
53
33
|
version: '0'
|
54
34
|
type: :runtime
|
55
35
|
prerelease: false
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
37
|
requirements:
|
59
|
-
- -
|
38
|
+
- - ">="
|
60
39
|
- !ruby/object:Gem::Version
|
61
40
|
version: '0'
|
62
41
|
- !ruby/object:Gem::Dependency
|
63
42
|
name: bundler
|
64
43
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
44
|
requirements:
|
67
|
-
- -
|
45
|
+
- - ">="
|
68
46
|
- !ruby/object:Gem::Version
|
69
47
|
version: 1.0.0
|
70
48
|
type: :development
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
51
|
requirements:
|
75
|
-
- -
|
52
|
+
- - ">="
|
76
53
|
- !ruby/object:Gem::Version
|
77
54
|
version: 1.0.0
|
78
55
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
56
|
+
name: jeweler
|
80
57
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
58
|
requirements:
|
83
|
-
- -
|
59
|
+
- - ">="
|
84
60
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
61
|
+
version: 1.5.2
|
86
62
|
type: :development
|
87
63
|
prerelease: false
|
88
64
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
65
|
requirements:
|
91
|
-
- -
|
66
|
+
- - ">="
|
92
67
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
68
|
+
version: 1.5.2
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: riot
|
96
71
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
72
|
requirements:
|
99
|
-
- -
|
73
|
+
- - ">="
|
100
74
|
- !ruby/object:Gem::Version
|
101
75
|
version: 0.12.3
|
102
76
|
type: :development
|
103
77
|
prerelease: false
|
104
78
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
79
|
requirements:
|
107
|
-
- -
|
80
|
+
- - ">="
|
108
81
|
- !ruby/object:Gem::Version
|
109
82
|
version: 0.12.3
|
110
83
|
description:
|
111
|
-
email:
|
84
|
+
email: martin@poljak.cz
|
112
85
|
executables: []
|
113
86
|
extensions: []
|
114
87
|
extra_rdoc_files:
|
115
88
|
- LICENSE.txt
|
116
89
|
- README.md
|
117
90
|
files:
|
118
|
-
- .document
|
91
|
+
- ".document"
|
119
92
|
- Gemfile
|
120
93
|
- Gemfile.lock
|
121
94
|
- LICENSE.txt
|
122
95
|
- README.md
|
123
96
|
- Rakefile
|
124
97
|
- VERSION
|
98
|
+
- em-wrapper.gemspec
|
125
99
|
- lib/em-wrapper.rb
|
126
100
|
- test
|
127
101
|
homepage: http://github.com/martinkozak/em-wrapper
|
128
102
|
licenses:
|
129
103
|
- MIT
|
104
|
+
metadata: {}
|
130
105
|
post_install_message:
|
131
106
|
rdoc_options: []
|
132
107
|
require_paths:
|
133
108
|
- lib
|
134
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
110
|
requirements:
|
137
|
-
- -
|
111
|
+
- - ">="
|
138
112
|
- !ruby/object:Gem::Version
|
139
113
|
version: '0'
|
140
|
-
segments:
|
141
|
-
- 0
|
142
|
-
hash: 3850679660524317222
|
143
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
115
|
requirements:
|
146
|
-
- -
|
116
|
+
- - ">="
|
147
117
|
- !ruby/object:Gem::Version
|
148
118
|
version: '0'
|
149
119
|
requirements: []
|
150
120
|
rubyforge_project:
|
151
|
-
rubygems_version:
|
121
|
+
rubygems_version: 2.4.5
|
152
122
|
signing_key:
|
153
|
-
specification_version:
|
123
|
+
specification_version: 4
|
154
124
|
summary: Wraps objects callbacks to EventMachine next ticks, so allows transparent
|
155
125
|
multiplexing of objects which aren't multiplexable by default.
|
156
126
|
test_files: []
|