parallizer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/parallizer.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'set'
2
2
  require 'work_queue'
3
3
  require 'parallizer/proxy'
4
+ require 'parallizer/method_call_notifier'
4
5
 
5
6
  class Parallizer
6
7
  attr_accessor :calls, :client
@@ -10,6 +11,12 @@ class Parallizer
10
11
  self.calls = Set.new
11
12
  end
12
13
 
14
+ def add
15
+ MethodCallNotifier.new do |*args|
16
+ self.calls.add(args)
17
+ end
18
+ end
19
+
13
20
  def add_call(method_name, *args)
14
21
  calls.add([method_name.to_sym, *args])
15
22
  end
@@ -0,0 +1,14 @@
1
+ require 'set'
2
+
3
+ class Parallizer
4
+ class MethodCallNotifier
5
+ def initialize(&callback)
6
+ @callback = callback
7
+
8
+ end
9
+
10
+ def method_missing(name, *arguments, &block)
11
+ @callback.call(name, *arguments)
12
+ end
13
+ end
14
+ end
data/parallizer.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallizer"
8
- s.version = "0.0.1"
8
+ s.version = "0.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 = ["Michael Pearce"]
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "lib/parallizer.rb",
27
+ "lib/parallizer/method_call_notifier.rb",
27
28
  "lib/parallizer/proxy.rb",
28
29
  "parallizer.gemspec",
29
30
  "test/parallizer/proxy_test.rb",
@@ -21,6 +21,21 @@ class ParallizerTest < Test::Unit::TestCase
21
21
  end
22
22
  end
23
23
 
24
+ context ".add" do
25
+ setup do
26
+ @client = TestObject.new
27
+ @parallizer = Parallizer.new(@client)
28
+ end
29
+
30
+ execute do
31
+ @parallizer.add.a_method('arg')
32
+ end
33
+
34
+ should "add call to calls" do
35
+ assert_equal [:a_method, 'arg'], @parallizer.calls.first
36
+ end
37
+ end
38
+
24
39
  context ".add_call" do
25
40
  setup do
26
41
  @client = TestObject.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -106,6 +106,7 @@ files:
106
106
  - Rakefile
107
107
  - VERSION
108
108
  - lib/parallizer.rb
109
+ - lib/parallizer/method_call_notifier.rb
109
110
  - lib/parallizer/proxy.rb
110
111
  - parallizer.gemspec
111
112
  - test/parallizer/proxy_test.rb
@@ -126,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
127
  version: '0'
127
128
  segments:
128
129
  - 0
129
- hash: 3246225958344608883
130
+ hash: -3165979574013539930
130
131
  required_rubygems_version: !ruby/object:Gem::Requirement
131
132
  none: false
132
133
  requirements: