spawnling 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spawnling.rb +3 -3
- data/lib/spawnling/version.rb +1 -1
- data/spec/spawn/spawn_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1547c27e7ec97c65047ba3205a96e310128950a0
|
4
|
+
data.tar.gz: 63635512ba55d8f1a6b842c50202ef5a0b1f82a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee4fd92e0b597bc3710a3bd0059f9fea5abee7970b802c4b7b105891a357c261ecf139fd3c07a77035c2a93714d9878ddade53ba2678ea2095843bd57abeac7
|
7
|
+
data.tar.gz: 871dc470a875cf7586d5e286f13028c0eaf800bc97a19e7688ee2bcc2d20d8bbe51c6731d235bac54cdd44977d1d200f0b3ef2bc73991b5692112e22ed30a4cb
|
data/lib/spawnling.rb
CHANGED
@@ -90,11 +90,11 @@ class Spawnling
|
|
90
90
|
# By default the process will be a forked process. To use threading, pass
|
91
91
|
# :method => :thread or override the default behavior in the environment by setting
|
92
92
|
# 'Spawnling::method :thread'.
|
93
|
-
def initialize(opts = {})
|
94
|
-
self.class.run(opts)
|
93
|
+
def initialize(opts = {}, &block)
|
94
|
+
self.class.run(opts, &block)
|
95
95
|
end
|
96
96
|
|
97
|
-
def self.run(opts = {})
|
97
|
+
def self.run(opts = {}, &block)
|
98
98
|
raise "Must give block of code to be spawned" unless block_given?
|
99
99
|
options = @@default_options.merge(symbolize_options(opts))
|
100
100
|
# setting options[:method] will override configured value in default_options[:method]
|
data/lib/spawnling/version.rb
CHANGED
data/spec/spawn/spawn_spec.rb
CHANGED
@@ -6,6 +6,14 @@ describe Spawnling do
|
|
6
6
|
before(:each) do
|
7
7
|
Spawnling::default_options :method => :yield
|
8
8
|
end
|
9
|
+
|
10
|
+
it "should work in new block" do
|
11
|
+
object = double('object')
|
12
|
+
object.should_receive(:do_something)
|
13
|
+
Spawnling.new do
|
14
|
+
object.do_something
|
15
|
+
end
|
16
|
+
end
|
9
17
|
|
10
18
|
it "should be able to yield directly" do
|
11
19
|
spawn!.should == "hello"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spawnling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Anderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|