async_methods 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +8 -9
- data/VERSION +1 -1
- data/async_methods.gemspec +20 -22
- data/spec/async_method_spec.rb +16 -16
- metadata +11 -12
- data/.gitignore +0 -1
data/Rakefile
CHANGED
@@ -6,14 +6,13 @@ desc 'Default: run unit tests.'
|
|
6
6
|
task :default => :test
|
7
7
|
|
8
8
|
begin
|
9
|
-
require '
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
9
|
+
require 'rspec'
|
10
|
+
require 'rspec/core/rake_task'
|
11
|
+
desc 'Run the unit tests'
|
12
|
+
RSpec::Core::RakeTask.new(:test)
|
14
13
|
rescue LoadError
|
15
|
-
|
16
|
-
STDERR.puts "You must have rspec
|
14
|
+
task :test do
|
15
|
+
STDERR.puts "You must have rspec 2.0 installed to run the tests"
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
@@ -32,11 +31,11 @@ begin
|
|
32
31
|
gem.summary = %Q{Gem that adds asynchronous method calls for all methods on every object to aid in throughput on I/O bound processes.}
|
33
32
|
gem.description = %Q(Gem that adds asynchronous method calls for all methods on every object to aid in throughput on I/O bound processes. This is intended to improve throughput on I/O bound processes like making several HTTP calls in row.)
|
34
33
|
gem.email = "brian@embellishedvisions.com"
|
35
|
-
gem.homepage = "http://github.com/bdurand/
|
34
|
+
gem.homepage = "http://github.com/bdurand/async_methods"
|
36
35
|
gem.authors = ["Brian Durand"]
|
37
36
|
gem.rdoc_options = ["--charset=UTF-8", "--main", "README.rdoc"]
|
38
37
|
|
39
|
-
gem.add_development_dependency('rspec', '>=
|
38
|
+
gem.add_development_dependency('rspec', '>= 2.0.0')
|
40
39
|
gem.add_development_dependency('jeweler')
|
41
40
|
end
|
42
41
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/async_methods.gemspec
CHANGED
@@ -1,57 +1,55 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{async_methods}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Durand"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-19}
|
13
13
|
s.description = %q{Gem that adds asynchronous method calls for all methods on every object to aid in throughput on I/O bound processes. This is intended to improve throughput on I/O bound processes like making several HTTP calls in row.}
|
14
14
|
s.email = %q{brian@embellishedvisions.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
"spec/spec_helper.rb"
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"async_methods.gemspec",
|
24
|
+
"lib/async_methods.rb",
|
25
|
+
"lib/async_methods/async_methods.rb",
|
26
|
+
"spec/async_method_spec.rb",
|
27
|
+
"spec/method_tester.rb",
|
28
|
+
"spec/spec_helper.rb"
|
30
29
|
]
|
31
|
-
s.homepage = %q{http://github.com/bdurand/
|
30
|
+
s.homepage = %q{http://github.com/bdurand/async_methods}
|
32
31
|
s.rdoc_options = ["--charset=UTF-8", "--main", "README.rdoc"]
|
33
32
|
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.
|
33
|
+
s.rubygems_version = %q{1.4.1}
|
35
34
|
s.summary = %q{Gem that adds asynchronous method calls for all methods on every object to aid in throughput on I/O bound processes.}
|
36
35
|
s.test_files = [
|
37
36
|
"spec/async_method_spec.rb",
|
38
|
-
|
39
|
-
|
37
|
+
"spec/method_tester.rb",
|
38
|
+
"spec/spec_helper.rb"
|
40
39
|
]
|
41
40
|
|
42
41
|
if s.respond_to? :specification_version then
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
42
|
s.specification_version = 3
|
45
43
|
|
46
44
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_development_dependency(%q<rspec>, [">=
|
45
|
+
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
|
48
46
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
49
47
|
else
|
50
|
-
s.add_dependency(%q<rspec>, [">=
|
48
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
51
49
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
52
50
|
end
|
53
51
|
else
|
54
|
-
s.add_dependency(%q<rspec>, [">=
|
52
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
55
53
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
56
54
|
end
|
57
55
|
end
|
data/spec/async_method_spec.rb
CHANGED
@@ -2,22 +2,22 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'async_m
|
|
2
2
|
Object.send(:include, AsyncMethods::InstanceMethods) unless Object.include?(AsyncMethods::InstanceMethods)
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + '/method_tester')
|
4
4
|
|
5
|
-
|
5
|
+
describe AsyncMethods::InstanceMethods do
|
6
6
|
|
7
7
|
let(:object) { AsyncMethods::Tester.new }
|
8
8
|
|
9
|
-
|
9
|
+
it "should inject async method handling" do
|
10
10
|
proxy = object.async_test("arg")
|
11
11
|
proxy.to_s.should == "ARG"
|
12
12
|
proxy.__proxy_loaded__.should == true
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
it "should return a proxy object that has not been invoked yet" do
|
16
16
|
proxy = object.async_test("arg", 1)
|
17
17
|
proxy.__proxy_loaded__.should == false
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
it "should be able to run a block asynchronously" do
|
21
21
|
proxy = asynchronous_block{object.test("arg", 0.1)}
|
22
22
|
proxy.__proxy_loaded__.should == false
|
23
23
|
proxy.to_s.should == "ARG"
|
@@ -26,35 +26,35 @@ context "AsyncMethods InstanceMethods" do
|
|
26
26
|
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
describe AsyncMethods::Proxy do
|
30
30
|
|
31
31
|
let(:object) { AsyncMethods::Tester.new }
|
32
32
|
|
33
|
-
|
33
|
+
it "should be able to wrap a method without waiting for it to finish" do
|
34
34
|
proxy = object.async_test("arg", 1)
|
35
35
|
object.test_called.should == 0
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
it "should execute the wrapped method when it needs to" do
|
39
39
|
proxy = object.async_test("arg")
|
40
40
|
proxy.to_s
|
41
41
|
object.test_called.should == 1
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
it "should only execute the wrapped method once" do
|
45
45
|
proxy = object.async_test("arg")
|
46
46
|
proxy.to_s
|
47
47
|
proxy.to_s
|
48
48
|
object.test_called.should == 1
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
it "should allow nil as a valid proxied value" do
|
52
52
|
proxy = object.async_test(nil)
|
53
53
|
proxy.should_not
|
54
54
|
object.test_called.should == 1
|
55
55
|
end
|
56
56
|
|
57
|
-
|
57
|
+
it "should allow blocks in the async method" do
|
58
58
|
n = 1
|
59
59
|
proxy = object.async_test("arg", 0.1) do
|
60
60
|
n = 2
|
@@ -64,23 +64,23 @@ context "AsyncMethods Proxy" do
|
|
64
64
|
n.should == 2
|
65
65
|
end
|
66
66
|
|
67
|
-
|
67
|
+
it "should be indistinguishable from the real object" do
|
68
68
|
proxy = object.async_test("arg")
|
69
69
|
proxy.class.should == String
|
70
70
|
proxy.kind_of?(String).should == true
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
it "should proxy core methods on Object" do
|
74
74
|
proxy = "xxx".async_to_s
|
75
75
|
proxy.should == "xxx"
|
76
76
|
end
|
77
77
|
|
78
|
-
|
78
|
+
it "should proxy missing methods" do
|
79
79
|
proxy = object.async_find_test
|
80
80
|
proxy.to_s.should == "FINDER"
|
81
81
|
end
|
82
82
|
|
83
|
-
|
83
|
+
it "should allow blocks in the async missing methods" do
|
84
84
|
n = 1
|
85
85
|
proxy = object.async_find_test do
|
86
86
|
n = 2
|
@@ -88,12 +88,12 @@ context "AsyncMethods Proxy" do
|
|
88
88
|
n.should == 2
|
89
89
|
end
|
90
90
|
|
91
|
-
|
91
|
+
it "should not interfere with the proxied object's method_missing" do
|
92
92
|
real = object.find_test
|
93
93
|
real.to_s.should == "FINDER"
|
94
94
|
end
|
95
95
|
|
96
|
-
|
96
|
+
it "should not interfere with real methods that begin with async_" do
|
97
97
|
object.async_real_method_called.should == false
|
98
98
|
object.async_real_method
|
99
99
|
object.async_real_method_called.should == true
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async_methods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Durand
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-19 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 15
|
30
30
|
segments:
|
31
|
-
-
|
32
|
-
-
|
31
|
+
- 2
|
32
|
+
- 0
|
33
33
|
- 0
|
34
|
-
version:
|
34
|
+
version: 2.0.0
|
35
35
|
type: :development
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -57,7 +57,6 @@ extensions: []
|
|
57
57
|
extra_rdoc_files:
|
58
58
|
- README.rdoc
|
59
59
|
files:
|
60
|
-
- .gitignore
|
61
60
|
- MIT-LICENSE
|
62
61
|
- README.rdoc
|
63
62
|
- Rakefile
|
@@ -69,7 +68,7 @@ files:
|
|
69
68
|
- spec/method_tester.rb
|
70
69
|
- spec/spec_helper.rb
|
71
70
|
has_rdoc: true
|
72
|
-
homepage: http://github.com/bdurand/
|
71
|
+
homepage: http://github.com/bdurand/async_methods
|
73
72
|
licenses: []
|
74
73
|
|
75
74
|
post_install_message:
|
@@ -100,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
99
|
requirements: []
|
101
100
|
|
102
101
|
rubyforge_project:
|
103
|
-
rubygems_version: 1.
|
102
|
+
rubygems_version: 1.4.1
|
104
103
|
signing_key:
|
105
104
|
specification_version: 3
|
106
105
|
summary: Gem that adds asynchronous method calls for all methods on every object to aid in throughput on I/O bound processes.
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
pkg
|