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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afe2261ea1a39c0cbb459886da3f12af8757874c
4
- data.tar.gz: c53f9cda870af2c9e361ca1c45769ae7bb61dcf1
3
+ metadata.gz: 1547c27e7ec97c65047ba3205a96e310128950a0
4
+ data.tar.gz: 63635512ba55d8f1a6b842c50202ef5a0b1f82a1
5
5
  SHA512:
6
- metadata.gz: d2f4925825d2577cb98bd380c2a2d10d1083d4de2b2be8764d3748d00480c48dde529ce999195709cc850b035dbb675078fa58d200f69a178c5c541e4126b5f7
7
- data.tar.gz: defaaebc1e9d420bb0d229b03b6ee1e4e84c1ba5dd936c18c9fc9f12ddab320903a110ecd011f6759537ccf4ae7a3bea93a49145a2e2c2f4251739fc12932f71
6
+ metadata.gz: 6ee4fd92e0b597bc3710a3bd0059f9fea5abee7970b802c4b7b105891a357c261ecf139fd3c07a77035c2a93714d9878ddade53ba2678ea2095843bd57abeac7
7
+ data.tar.gz: 871dc470a875cf7586d5e286f13028c0eaf800bc97a19e7688ee2bcc2d20d8bbe51c6731d235bac54cdd44977d1d200f0b3ef2bc73991b5692112e22ed30a4cb
@@ -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]
@@ -1,3 +1,3 @@
1
1
  class Spawnling
2
- VERSION = '2.1.2'
2
+ VERSION = '2.1.3'
3
3
  end
@@ -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.2
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-01 00:00:00.000000000 Z
11
+ date: 2014-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler