asyroyez_palindrome 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asyroyez_palindrome/version.rb +1 -1
- data/lib/asyroyez_palindrome.rb +10 -2
- 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: da81b3209d6a93f141b60f1c0debe88294cdf5de4d71a7b63378f7bc77868638
|
4
|
+
data.tar.gz: 5f8319a6af4cedb8906879cb0f96eed0a3775f314885fde36dd6617b5fd32248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19ac1908d5993b2b4dcffc42f5eeebf358ea583fa277a6533694336f0e153565fa7587c2c7afeda45443dbe822d2a78d2b8ee8bd5b0a1e14e8b58c8050a4f9d
|
7
|
+
data.tar.gz: 2b91d589f57b01c959ed052a9f815594ee3fa5a826e077bfc3f55d588e8cc75bd62027511e0fd75305e532e8caff6271d44447769d0ec6a9b39b143fe0dc7ec8
|
data/lib/asyroyez_palindrome.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "asyroyez_palindrome/version"
|
2
2
|
|
3
|
-
|
3
|
+
module AsyroyezPalindrome
|
4
4
|
# Returns true for a palindrome, false otherwise.
|
5
5
|
def palindrome?
|
6
6
|
processed_content == processed_content.reverse
|
@@ -10,6 +10,14 @@ class String
|
|
10
10
|
|
11
11
|
# Returns content for palindrome testing
|
12
12
|
def processed_content
|
13
|
-
scan(/[a-z]/i).join.downcase
|
13
|
+
to_s.scan(/[a-z\d]/i).join.downcase
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
class String
|
18
|
+
include AsyroyezPalindrome
|
19
|
+
end
|
20
|
+
|
21
|
+
class Integer
|
22
|
+
include AsyroyezPalindrome
|
23
|
+
end
|