lazy_object 0.0.1 → 0.0.2

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: aa8f097ab93f787bc0544655c36e2e9a3c18b76e
4
- data.tar.gz: a205632317cebe3b2aa4815d2f28dd22ce6e6338
3
+ metadata.gz: ebb871ef07298953b636aa9828c59f34798fce67
4
+ data.tar.gz: 2e8e8311a5aa1d96849518eb6b8a12cea99615cb
5
5
  SHA512:
6
- metadata.gz: 884dd1cf3271cb7114d28cb05523e1bcfc52a49424a64449454a897525b44d50cb37682e7407d5e861c340c9c30dfdf40d7d7f4123531f086e03ec98c7e3f979
7
- data.tar.gz: 051172b7cc239277a07a752d98413a4a6deacbae09729253f013c3040595d5a91ab64d507e4a41c3d91ef33e580d39eebbdb9b01fa8310108638d4463ee75b3a
6
+ metadata.gz: fe6da338b447ba9457679df275a22a8ec07a4f8bd86849054c0e9f8c754ac4a7cf011b971fac1b88d5d316fd3a9c9c9b04373931c7ac1e60ffa0729ccb527e60
7
+ data.tar.gz: 0db17e239189b4c24fdf06614c44f578c54ccf8eef0c8a29950b60aba4b94543edb55c06fdf5e352847de299e9dcd8297e2a33c2d97caba00d97d0a8337360be
data/lib/lazy_object.rb CHANGED
@@ -8,12 +8,12 @@
8
8
  #
9
9
  # lazy = LazyObject.new { VeryExpensiveObject.new } # At this point the VeryExpensiveObject hasn't been initialized yet.
10
10
  # lazy.get_expensive_results(foo, bar) # Initializes VeryExpensiveObject and calls 'get_expensive_results' on it, passing in foo and bar
11
- class LazyObject
12
-
11
+ class LazyObject < BasicObject
12
+
13
13
  def self.version
14
- '0.0.1'
14
+ '0.0.2'
15
15
  end
16
-
16
+
17
17
  def initialize(&callable)
18
18
  @__callable__ = callable
19
19
  end
@@ -4,12 +4,12 @@ RSpec.describe LazyObject do
4
4
 
5
5
  class TargetObject
6
6
  attr_accessor :value
7
-
7
+
8
8
  def method_with_yield(foo)
9
9
  yield foo
10
10
  end
11
11
  end
12
-
12
+
13
13
  let(:lazy_object) {
14
14
  LazyObject.new do
15
15
  targ = TargetObject.new
@@ -17,12 +17,12 @@ RSpec.describe LazyObject do
17
17
  targ
18
18
  end
19
19
  }
20
-
20
+
21
21
  it 'should call the init block and forward methods to the target object' do
22
22
  expect( lazy_object.value ).to eq(:foo)
23
23
  lazy_object.value = :bar
24
24
  expect( lazy_object.value ).to eq(:bar)
25
-
25
+
26
26
  expect( lazy_object.method_with_yield(:baz) { |foo| "--#{foo}--" } ).to eq('--baz--')
27
27
  end
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Shagall
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-03 00:00:00.000000000 Z
12
+ date: 2015-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.2.2
96
+ rubygems_version: 2.4.3
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Lazily initialized object wrapper.