transparent_proxy 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/transparent_proxy.rb +8 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37acbffe010f5a7cc7232c7ed5de1ae2ed9b5350
4
- data.tar.gz: 10aaddbd80122deab1b4b5bb6eae0b2344cd66e2
3
+ metadata.gz: 919640357dd2afac68f22a99f357c17bdec027c3
4
+ data.tar.gz: ad42c87b7ac48c3c1fe231ecb19202b9de99517b
5
5
  SHA512:
6
- metadata.gz: 3afcb545d0eb893599108882bb136adbe89948fe6130c779898a5155729d54f5223ae9429353fd979e17170ec8f85aaab1ebd4fcc6b6ec652401ce02a417ed50
7
- data.tar.gz: 9f322b1f40ab79346774fb582c389c714417d773014e2507da01c0ece161dce048668ccfaa1d6ff952eaa31f95d2849bb0e8576181f977089b0a3a74103caca4
6
+ metadata.gz: f1d9fba7168266445cf96306c773e2edef7ba619309bd9857b703c367cc7e8d398ab56a5cfaf861505074e842848eed0498b495491f51c2053cf9e57f12b7fd7
7
+ data.tar.gz: ff308a9a41f19b5694fe5a1fdae0d57cc4d3f532156fd88612a3d508ef925d31d6ade1ddbe9a2dc8ed8586e8ee0e1ccff1fceb5f37fe17ca32c5393714fcf609
@@ -1,6 +1,6 @@
1
1
  class TransparentProxy
2
2
 
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
 
5
5
  proxy_methods = [:class, :methods, :respond_to?]
6
6
 
@@ -12,7 +12,7 @@ class TransparentProxy
12
12
  each { |m| undef_method m }
13
13
 
14
14
  def inspect
15
- __target__.inspect
15
+ __getobj__.inspect
16
16
  end
17
17
 
18
18
  def proxy_inspect
@@ -20,11 +20,11 @@ class TransparentProxy
20
20
  end
21
21
 
22
22
  def methods(*args)
23
- proxy_methods(*args) | __target__.methods(*args)
23
+ proxy_methods(*args) | __getobj__.methods(*args)
24
24
  end
25
25
 
26
26
  def respond_to?(*args)
27
- proxy_respond_to?(*args) || __target__.respond_to?(*args)
27
+ proxy_respond_to?(*args) || __getobj__.respond_to?(*args)
28
28
  end
29
29
 
30
30
  def proxy?
@@ -34,16 +34,15 @@ class TransparentProxy
34
34
  private
35
35
 
36
36
  def initialize(object=nil, &block)
37
- @target = object
38
- @target_block = block
37
+ @lazy_object = block_given? ? block : ->() { object }
39
38
  end
40
39
 
41
- def __target__
42
- @target ||= @target_block.call
40
+ def __getobj__
41
+ @object ||= @lazy_object.call
43
42
  end
44
43
 
45
44
  def method_missing(method, *args, &block)
46
- __target__.send(method, *args, &block)
45
+ __getobj__.send(method, *args, &block)
47
46
  end
48
47
 
49
48
  end
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.3
4
+ version: 0.0.4
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-25 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler