mpatch 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/mpatch/string.rb +30 -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: 0e60f14f842009d5e1e8fb4c4332b32be0357716
|
4
|
+
data.tar.gz: 11524222db34b9a1069519972adcd56391fd9eda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b97e7f1fb9e5c95811a0eb47be2d49361262043902b156b4d870f284b58f5b43b80603da4e2d4bcc2167e50f49919f99147aac74cc29b4a760553977dc9a3f77
|
7
|
+
data.tar.gz: c978d3555d82b865219c005a7f1ee3cfa77f68644d539d3db90a34c2ecf2eb2a2be41e70b462bab68a02b310420ba4dec46343534cb3d559f135d63b537fa3a1
|
data/VERSION
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
2.
|
1
|
+
2.6.0
|
2
2
|
|
data/lib/mpatch/string.rb
CHANGED
@@ -79,6 +79,36 @@ module MPatch
|
|
79
79
|
self.scan(/#{str}/).count
|
80
80
|
end
|
81
81
|
|
82
|
+
# return true or false
|
83
|
+
def check obj
|
84
|
+
|
85
|
+
case true
|
86
|
+
|
87
|
+
when obj.class <= Regexp
|
88
|
+
return ((self =~ obj).nil? ? false : true)
|
89
|
+
|
90
|
+
when obj.class <= String
|
91
|
+
return self.include?(obj)
|
92
|
+
|
93
|
+
when obj.class <= Array
|
94
|
+
obj.each do |element|
|
95
|
+
if self.check(element) == true
|
96
|
+
return true
|
97
|
+
end
|
98
|
+
end
|
99
|
+
return false
|
100
|
+
|
101
|
+
when obj.class <= Hash
|
102
|
+
raise ArgumentError, "not implemented object for #{__method__} method"
|
103
|
+
|
104
|
+
else
|
105
|
+
return self.include?(obj.to_s)
|
106
|
+
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
82
112
|
end
|
83
113
|
|
84
114
|
end
|