transparent_proxy 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 919640357dd2afac68f22a99f357c17bdec027c3
4
- data.tar.gz: ad42c87b7ac48c3c1fe231ecb19202b9de99517b
2
+ SHA256:
3
+ metadata.gz: 3f6f08e90110d0edd55423b27fa077b9c206211becadfe5525cc7e2dc9f52121
4
+ data.tar.gz: 227d9e82a27d3937c3b083dc991835036c002eaa91f840e75d88a84e9c7eb4c8
5
5
  SHA512:
6
- metadata.gz: f1d9fba7168266445cf96306c773e2edef7ba619309bd9857b703c367cc7e8d398ab56a5cfaf861505074e842848eed0498b495491f51c2053cf9e57f12b7fd7
7
- data.tar.gz: ff308a9a41f19b5694fe5a1fdae0d57cc4d3f532156fd88612a3d508ef925d31d6ade1ddbe9a2dc8ed8586e8ee0e1ccff1fceb5f37fe17ca32c5393714fcf609
6
+ metadata.gz: 4d1738753c1fb01bdfb01390df7b67e97cede3c03a359cf82978caa797e51e1f33af63111f78ca788823dc57fdd0ec3777096241288c4fad71a5d0132ca14f9c
7
+ data.tar.gz: 165411402a2fe6f7babb3fe74d3c5158560b1cf59ef050984be72a66aa4eeba9fbf1e067d486eeea9224106c0d1428de1b7acd5cc5757b79507b1bdc6ce82c64
@@ -1,6 +1,6 @@
1
1
  class TransparentProxy
2
2
 
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
 
5
5
  proxy_methods = [:class, :methods, :respond_to?]
6
6
 
@@ -34,11 +34,11 @@ class TransparentProxy
34
34
  private
35
35
 
36
36
  def initialize(object=nil, &block)
37
- @lazy_object = block_given? ? block : ->() { object }
37
+ @lazy_object = block_given? ? block : object
38
38
  end
39
39
 
40
40
  def __getobj__
41
- @object ||= @lazy_object.call
41
+ @object ||= @lazy_object.is_a?(Proc) ? @lazy_object.call : @lazy_object
42
42
  end
43
43
 
44
44
  def method_missing(method, *args, &block)
@@ -11,7 +11,7 @@ describe TransparentProxy do
11
11
  it label do
12
12
  proxy.must_equal 2
13
13
  (proxy + 1).must_equal 3
14
- proxy.class.must_equal Fixnum
14
+ proxy.class.must_equal Integer
15
15
  proxy.inspect.must_equal 2.inspect
16
16
  proxy.methods.must_equal proxy.proxy_methods | 2.methods
17
17
  proxy.respond_to?(:+).must_equal true
@@ -23,10 +23,11 @@ describe TransparentProxy do
23
23
 
24
24
  proxy.proxy?.must_equal true
25
25
  proxy.proxy_class.must_equal TransparentProxy
26
- proxy.proxy_inspect.must_match /#<TransparentProxy @object=1>/
26
+ proxy.proxy_inspect.must_match(/#<TransparentProxy @object=1>/)
27
27
  proxy.proxy_methods.must_include_all [:__send__, :__id__, :object_id, :tap]
28
28
  proxy.proxy_respond_to?(:object_id).must_equal true
29
29
  proxy.proxy_respond_to?(:+).must_equal false
30
+ Marshal.load(Marshal.dump(proxy)).must_equal 1
30
31
  end
31
32
 
32
33
  it 'Subclass' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transparent_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2019-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.2.2
147
+ rubygems_version: 2.7.3
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Transparent proxy