SampleGemTwo 1.0.0 → 1.1.0
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 +4 -4
- data/lib/SampleGemTwo/version.rb +1 -1
- data/lib/SampleGemTwo.rb +59 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d48c25c70be4ecf7e9259027311472836ae15ac5bcab901bd72f978d88b6a1dd
|
4
|
+
data.tar.gz: 22425037d5f13fed041314f7289db8a5ccd4c3e09bdd840b516ac06ff66708ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d41074dd3a6a65bf1e836bb2d5e8bc53bb0bafbe001bf39cc321d00d3dda24495a79080d556c8bdb01ecef4e7fa58d1a233363c6b3ffd96d58019107c66b66f
|
7
|
+
data.tar.gz: '0187340295bc06bf0c7de18b9a27fb8202be3a6d7a2a898fb9d635eb0301440c5ae8bc344b9ddf2ef0c3ad722895acd9875e8c67f2dbecb1b3ab5eff8eb29f72'
|
data/lib/SampleGemTwo/version.rb
CHANGED
data/lib/SampleGemTwo.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
|
2
|
+
=begin
|
1
3
|
require "SampleGemTwo/version"
|
2
4
|
require 'SampleGemOne'
|
3
5
|
|
@@ -12,8 +14,65 @@ module SampleGemTwo
|
|
12
14
|
puts " nw method new printer"
|
13
15
|
ggk
|
14
16
|
end
|
17
|
+
alias_method :printerold,:printer
|
15
18
|
alias_method :printer,:newprinter
|
16
19
|
end
|
17
20
|
|
18
21
|
|
19
22
|
end
|
23
|
+
|
24
|
+
=end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
require "SampleGemTwo/version"
|
39
|
+
require 'SampleGemOne'
|
40
|
+
|
41
|
+
module SampleGemTwo
|
42
|
+
include SampleGemOne
|
43
|
+
|
44
|
+
def SampleGemTwo.alias_method_chain(target, feature)
|
45
|
+
# Strip out punctuation on predicates or bang methods since
|
46
|
+
# e.g. target?_without_feature is not a valid method name.
|
47
|
+
aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
|
48
|
+
yield(aliased_target, punctuation) if block_given?
|
49
|
+
|
50
|
+
with_method, without_method = "#{aliased_target}_with_#{feature}#{punctuation}", "#{aliased_target}_without_#{feature}#{punctuation}"
|
51
|
+
|
52
|
+
alias_method without_method, target
|
53
|
+
alias_method target, with_method
|
54
|
+
|
55
|
+
case
|
56
|
+
when public_method_defined?(without_method)
|
57
|
+
public target
|
58
|
+
when protected_method_defined?(without_method)
|
59
|
+
protected target
|
60
|
+
when private_method_defined?(without_method)
|
61
|
+
private target
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class B
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
class SampleGemOne::A
|
70
|
+
def printer_with_feature
|
71
|
+
puts " nw method new printer"
|
72
|
+
|
73
|
+
end
|
74
|
+
SampleGemTwo.alias_method_chain :printer,:feature
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
end
|