futuroscope 0.1.6 → 0.1.7

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: 1ef137acb5fd8708b3c63a81a1e9c96c3f7dbaeb
4
- data.tar.gz: 7f47c7f63fd968b294b36fabfb16682778021188
3
+ metadata.gz: 03cdb1ddd7c212ef63c625d610754a92386a1c73
4
+ data.tar.gz: 90f54b489a3176aa6ad82c17195cb7d8e429d687
5
5
  SHA512:
6
- metadata.gz: 7dbe628ed0f35068dffd023b3e2cac9a00d4dc9bbe615924751ebc152e080691f5f5d225ffe7c611613e717ccf7d38e4f06c816442cf1ea92c63174d2b7482d0
7
- data.tar.gz: 4a91dbb0b276262cc77d76a55f847c5a25424d2882beadf6c4c20578e4cd17eee4db3da7a177a6d29636f9e44675d2fd5ace47b55bb18f48a3ccf45a4ae2826e
6
+ metadata.gz: a7cf8ff237e9610854c1dd2ab2aabb24143ce632cdf376900e68685811ba72075532c8eb0d06e685992de2ac1a5bc1da556774f9b1ce4db6a7e0e62c5fda752f
7
+ data.tar.gz: 7dd1ea1d9c1dda894349798a74da9b9b3f05a73774c2a135b213b762662f8ac0ef9fd6d6723eac02c77c3b7ada1082601930a203c83a3fa6c0fa05f120d22f4e
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
data/.travis.yml CHANGED
@@ -1,5 +1,8 @@
1
+ language: ruby
2
+ cache: bundler
1
3
  rvm:
2
4
  - 1.9.3
3
5
  - 2.0.0
4
- - rbx-19mode
6
+ - rbx
7
+ - 2.1.0
5
8
  - jruby-19mode
data/Gemfile CHANGED
@@ -6,5 +6,8 @@ gem 'guard-bundler'
6
6
 
7
7
  gem 'coveralls'
8
8
 
9
+ gem 'json'
10
+ gem 'rubysl', platform: :rbx
11
+
9
12
  # Specify your gem's dependencies in futuroscope.gemspec
10
13
  gemspec
data/README.md CHANGED
@@ -17,14 +17,14 @@ You can learn more about futures here in this excellent article from @jpignata:
17
17
  [Concurrency Patterns in Ruby:
18
18
  Futures](http://tx.pignata.com/2012/11/concurrency-patterns-in-ruby-futures.html)
19
19
 
20
- In Futuroscope, futures are instantiated with a simple ruby block. The future's
20
+ In Futuroscope, futures are instantiated with a simple ruby block. The future's
21
21
  execution will immediately start in a different thread and when you call a
22
22
  method on in it will be forwarded to the block's return value.
23
23
 
24
24
  If the thread didn't finish yet, it will block the program's execution until
25
25
  it's finished. Otherwise, it will immediately return its value.
26
26
 
27
- Futuroscope is tested on `MRI 1.9.3`, `MRI 2.0.0`, `Rubinius (1.9)` and `JRuby (1.9)`.
27
+ Futuroscope is tested on `MRI 1.9.3`, `MRI 2.0.0`, `MRI 2.1.0`, `Rubinius (1.9)` and `JRuby (1.9)`.
28
28
 
29
29
  Check out [futuroscope's post on Codegram's blog](http://blog.codegram.com/2013/5/new-gem-released-futuroscope) to get started.
30
30
 
@@ -120,9 +120,9 @@ end
120
120
 
121
121
  ## Considerations
122
122
 
123
- You should never add **side-effects** to a future. They have to be thought of
124
- like they were a local variable, with the only outcome that they're returning a
125
- value.
123
+ You should never add **side-effects** to a future. They have to be thought of
124
+ like they were a local variable, with the only outcome that they're returning a
125
+ value.
126
126
 
127
127
  You have to take into account that they really run in a different thread, so
128
128
  you'll be potentially accessing code in parallel that could not be thread-safe.
data/futuroscope.gemspec CHANGED
@@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "rspec-mocks"
25
+ spec.add_runtime_dependency 'rubysl' if RUBY_ENGINE == 'rbx'
25
26
  end
@@ -51,12 +51,16 @@ module Futuroscope
51
51
  resolved[:value]
52
52
  end
53
53
 
54
+ def __setobj__ obj
55
+ @resolved_future = { value: obj }
56
+ end
57
+
54
58
  def marshal_dump
55
59
  resolved_future_value
56
60
  end
57
61
 
58
- def __setobj__ obj
59
- @resolved_future = obj
62
+ def marshal_load value
63
+ @resolved_future = value
60
64
  end
61
65
 
62
66
  def_delegators :__getobj__, :class, :kind_of?, :is_a?, :clone
@@ -1,3 +1,3 @@
1
1
  module Futuroscope
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -46,7 +46,7 @@ module Futuroscope
46
46
  end
47
47
 
48
48
  it "returns the original object when future_value gets called" do
49
- object = mock()
49
+ object = double
50
50
  future = Future.new{ object }
51
51
 
52
52
  expect(future.future_value.object_id === object.object_id).to eq(true)
@@ -59,5 +59,12 @@ module Futuroscope
59
59
  expect(Marshal.load(dumped).future_value).to eq(object)
60
60
  end
61
61
 
62
+ it "correctly duplicates a future object" do
63
+ object = [1, 2, 3]
64
+ future = Future.new { object }
65
+
66
+ expect(future.dup).to eq future
67
+ end
68
+
62
69
  end
63
70
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- if ENV["CI"]
1
+ if ENV["CI"] && RUBY_ENGINE == "ruby"
2
2
  require 'coveralls'
3
3
  Coveralls.wear!
4
4
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: futuroscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-12 00:00:00.000000000 Z
11
+ date: 2014-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-mocks
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Futuroscope is yet another simple gem that implements the Futures concurrency
@@ -74,11 +74,11 @@ executables: []
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
78
- - .rspec
79
- - .ruby-gemset
80
- - .ruby-version
81
- - .travis.yml
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".ruby-gemset"
80
+ - ".ruby-version"
81
+ - ".travis.yml"
82
82
  - Gemfile
83
83
  - Guardfile
84
84
  - LICENSE.txt
@@ -110,17 +110,17 @@ require_paths:
110
110
  - lib
111
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - '>='
118
+ - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.0.3
123
+ rubygems_version: 2.2.0
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Futuroscope is yet another simple gem that implements the Futures concurrency
@@ -133,4 +133,3 @@ test_files:
133
133
  - spec/futuroscope/worker_spec.rb
134
134
  - spec/futuroscope_spec.rb
135
135
  - spec/spec_helper.rb
136
- has_rdoc: