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 +4 -4
- data/lib/delegate_it/main.rb +1 -1
- data/lib/delegate_it/version.rb +1 -1
- data/spec/delegate_it/main_spec.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e57152f604c87fa5c3232b78d9a35cfdd5b9ea82
|
4
|
+
data.tar.gz: a5329c960ac1e9efbe11d9f5bdb49fe09076e84e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8e6667235220cc6ef4d55f16ecb623b91603ac15a6c2efb99636ecd74255ca94a97960cdc248924a63d8b591196d910ed96ffa38dda1546eaf68d7cf1b036f4
|
7
|
+
data.tar.gz: f3e461c652478fcadba16bc4ca59fa23d739e6ea554f1eb844057bab21f0904283ec1ceb307e31208ff4355c015c458f8161189b865d34fcac9725fa3189e94b
|
data/lib/delegate_it/main.rb
CHANGED
data/lib/delegate_it/version.rb
CHANGED
@@ -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
|