File tree Expand file tree Collapse file tree
exercises/concept/last-will Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,19 +13,21 @@ They are used together by prefixing their respective namespaces.
1313
1414``` ruby
1515class MyNamespace
16- def self .foo
17- 44
18- end
19- class MyInnerNamespace
20- def self .baz
21- 90
22- end
16+ def self .foo
17+ 44
18+ end
19+
20+ class MyInnerNamespace
21+ def self .baz
22+ 90
2323 end
24+ end
2425end
26+
2527class MyOtherNamespace
26- def self .foo
27- - 2
28- end
28+ def self .foo
29+ - 2
30+ end
2931end
3032
3133p MyNamespace ::foo + MyOtherNamespace ::foo * MyNamespace ::MyInnerNamespace ::baz # => -136
@@ -42,12 +44,15 @@ class Example
4244 5
4345 end
4446end
47+
4548class MyNamespace
49+
4650 class Example
4751 def self .example
4852 10
4953 end
5054 end
55+
5156 def self .call_example
5257 p Example ::example # => 10
5358 p ::Example ::example # => 5
Original file line number Diff line number Diff line change @@ -13,19 +13,21 @@ They are used together by prefixing their respective namespaces.
1313
1414``` ruby
1515class MyNamespace
16- def self .foo
17- 44
18- end
19- class MyInnerNamespace
20- def self .baz
21- 90
22- end
16+ def self .foo
17+ 44
18+ end
19+
20+ class MyInnerNamespace
21+ def self .baz
22+ 90
2323 end
24+ end
2425end
26+
2527class MyOtherNamespace
26- def self .foo
27- - 2
28- end
28+ def self .foo
29+ - 2
30+ end
2931end
3032
3133p MyNamespace ::foo + MyOtherNamespace ::foo * MyNamespace ::MyInnerNamespace ::baz # => -136
@@ -42,12 +44,15 @@ class Example
4244 5
4345 end
4446end
47+
4548class MyNamespace
49+
4650 class Example
4751 def self .example
4852 10
4953 end
5054 end
55+
5156 def self .call_example
5257 p Example ::example # => 10
5358 p ::Example ::example # => 5
Original file line number Diff line number Diff line change @@ -13,19 +13,21 @@ They are used together by prefixing their respective namespaces.
1313
1414``` ruby
1515class MyNamespace
16- def self .foo
17- 44
18- end
19- class MyInnerNamespace
20- def self .baz
21- 90
22- end
16+ def self .foo
17+ 44
18+ end
19+
20+ class MyInnerNamespace
21+ def self .baz
22+ 90
2323 end
24+ end
2425end
26+
2527class MyOtherNamespace
26- def self .foo
27- - 2
28- end
28+ def self .foo
29+ - 2
30+ end
2931end
3032
3133p MyNamespace ::foo + MyOtherNamespace ::foo * MyNamespace ::MyInnerNamespace ::baz # => -136
@@ -42,12 +44,15 @@ class Example
4244 5
4345 end
4446end
47+
4548class MyNamespace
49+
4650 class Example
4751 def self .example
4852 10
4953 end
5054 end
55+
5156 def self .call_example
5257 p Example ::example # => 10
5358 p ::Example ::example # => 5
Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ def self.bank_number_part(secret_modifier)
44 zhang_part = 8541
55 ( zhang_part * secret_modifier ) % 10000
66 end
7+
78 class Red
89 def self . code_fragment
910 512
1011 end
1112 end
13+
1214 class Blue
1315 def self . code_fragment
1416 677
@@ -22,11 +24,13 @@ def self.bank_number_part(secret_modifier)
2224 khan_part = 4142
2325 ( khan_part * secret_modifier ) % 10000
2426 end
27+
2528 class Red
2629 def self . code_fragment
2730 148
2831 end
2932 end
33+
3034 class Blue
3135 def self . code_fragment
3236 875
@@ -40,11 +44,13 @@ def self.bank_number_part(secret_modifier)
4044 garcia_part = 4023
4145 ( garcia_part * secret_modifier ) % 10000
4246 end
47+
4348 class Red
4449 def self . code_fragment
4550 118
4651 end
4752 end
53+
4854 class Blue
4955 def self . code_fragment
5056 923
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ def self.bank_number_part(secret_modifier)
66 zhang_part = 8541
77 ( zhang_part * secret_modifier ) % 10000
88 end
9+
910 class Red
1011 def self . code_fragment
1112 512
1213 end
1314 end
15+
1416 class Blue
1517 def self . code_fragment
1618 677
@@ -24,11 +26,13 @@ def self.bank_number_part(secret_modifier)
2426 khan_part = 4142
2527 ( khan_part * secret_modifier ) % 10000
2628 end
29+
2730 class Red
2831 def self . code_fragment
2932 148
3033 end
3134 end
35+
3236 class Blue
3337 def self . code_fragment
3438 875
@@ -42,11 +46,13 @@ def self.bank_number_part(secret_modifier)
4246 garcia_part = 4023
4347 ( garcia_part * secret_modifier ) % 10000
4448 end
49+
4550 class Red
4651 def self . code_fragment
4752 118
4853 end
4954 end
55+
5056 class Blue
5157 def self . code_fragment
5258 923
You can’t perform that action at this time.
0 commit comments