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 +5 -5
- data/lib/transparent_proxy.rb +3 -3
- data/spec/transparent_proxy_spec.rb +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f6f08e90110d0edd55423b27fa077b9c206211becadfe5525cc7e2dc9f52121
|
4
|
+
data.tar.gz: 227d9e82a27d3937c3b083dc991835036c002eaa91f840e75d88a84e9c7eb4c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d1738753c1fb01bdfb01390df7b67e97cede3c03a359cf82978caa797e51e1f33af63111f78ca788823dc57fdd0ec3777096241288c4fad71a5d0132ca14f9c
|
7
|
+
data.tar.gz: 165411402a2fe6f7babb3fe74d3c5158560b1cf59ef050984be72a66aa4eeba9fbf1e067d486eeea9224106c0d1428de1b7acd5cc5757b79507b1bdc6ce82c64
|
data/lib/transparent_proxy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class TransparentProxy
|
2
2
|
|
3
|
-
VERSION = '0.0.
|
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 :
|
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
|
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
|
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
|
+
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:
|
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.
|
147
|
+
rubygems_version: 2.7.3
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Transparent proxy
|