delegate_it 0.0.2 → 0.0.3

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: b54e8408c7b5f3f998ddb38bc4cab1e3ed41a323
4
- data.tar.gz: 2a48cdc1da2cd8ea2c496a01e2e38c3f3c62ba13
3
+ metadata.gz: e57152f604c87fa5c3232b78d9a35cfdd5b9ea82
4
+ data.tar.gz: a5329c960ac1e9efbe11d9f5bdb49fe09076e84e
5
5
  SHA512:
6
- metadata.gz: ee70d3a7896a7896a7f563a771d297873d6e4d6cb00ebfa140c7e44b33a6cc2c5bcca8eb0cfb39a59475fce13adfa1c70dcc089bbf123b66e1137eb24879f353
7
- data.tar.gz: 4ddf92873d71eea10a6a24f9cb56f626a7dca6091a0d3190dbf0f2cd4f8a34a63a21466a4996a44369bb6ad81a85c036132577ac3e53004ba93004b0937f5640
6
+ metadata.gz: c8e6667235220cc6ef4d55f16ecb623b91603ac15a6c2efb99636ecd74255ca94a97960cdc248924a63d8b591196d910ed96ffa38dda1546eaf68d7cf1b036f4
7
+ data.tar.gz: f3e461c652478fcadba16bc4ca59fa23d739e6ea554f1eb844057bab21f0904283ec1ceb307e31208ff4355c015c458f8161189b865d34fcac9725fa3189e94b
@@ -17,7 +17,7 @@ module DelegateIt
17
17
  end.first
18
18
 
19
19
  if setting
20
- receiver = if self.respond_to?(setting.options[:to])
20
+ receiver = if self.respond_to?(setting.options[:to], true)
21
21
  self.send(setting.options[:to])
22
22
  else
23
23
  nil
@@ -1,3 +1,3 @@
1
1
  module DelegateIt
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -8,6 +8,7 @@ class Dummy
8
8
  delegate :there, to: :there_delegate, allow_nil: true
9
9
  delegate :one, to: :args_delegate
10
10
  delegate :print, to: :args_delegate
11
+ delegate :secret, to: :keeper
11
12
 
12
13
  def name_delegate
13
14
  Struct.new(:name, :surname).new('name_val', 'surname_val')
@@ -30,6 +31,12 @@ class Dummy
30
31
 
31
32
  dynamic_class.new
32
33
  end
34
+
35
+ private
36
+
37
+ def keeper
38
+ Struct.new(:secret).new(42)
39
+ end
33
40
  end
34
41
 
35
42
  describe 'DelegateIt' do
@@ -56,6 +63,12 @@ describe 'DelegateIt' do
56
63
  end
57
64
  end
58
65
 
66
+ describe "private delegators" do
67
+ it "works" do
68
+ expect(subject.secret).to eq 42
69
+ end
70
+ end
71
+
59
72
  describe "allow_nil case" do
60
73
  context "receiver is nil" do
61
74
  it "returns nil" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delegate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb