mpatch 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/mpatch/string.rb +30 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d53e38d15e8fec6a65e1e4288e91d8571af3006a
4
- data.tar.gz: ccfc2130a2ddf29110613c64312c4b94485acde7
3
+ metadata.gz: 0e60f14f842009d5e1e8fb4c4332b32be0357716
4
+ data.tar.gz: 11524222db34b9a1069519972adcd56391fd9eda
5
5
  SHA512:
6
- metadata.gz: 05f488b571ecd8e8ea46440c034175b521bd50ab1d967310618ae7d14aa09b9a10bc1fd52041295887aee504b744692ee16f0611273e98119825e27bb9039af4
7
- data.tar.gz: 283cf69482ad4927e4dbdf7c0c8f970e12266af23ef87481788ddcd740d25fff10928dc9cc72c18d6af48b99d43364599cbe2bf2d690c2580fa2fd05e2b7e05d
6
+ metadata.gz: b97e7f1fb9e5c95811a0eb47be2d49361262043902b156b4d870f284b58f5b43b80603da4e2d4bcc2167e50f49919f99147aac74cc29b4a760553977dc9a3f77
7
+ data.tar.gz: c978d3555d82b865219c005a7f1ee3cfa77f68644d539d3db90a34c2ecf2eb2a2be41e70b462bab68a02b310420ba4dec46343534cb3d559f135d63b537fa3a1
data/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- 2.5.0
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi