snoseeds_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/snoseeds_palindrome/version.rb +1 -1
- data/lib/snoseeds_palindrome.rb +10 -8
- 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: 49839d9b94ee97dd530e71f3fd44a6ab072c22382c7e0507ae4d5e088dc21e38
|
4
|
+
data.tar.gz: '04559b6f98a2eb163d3cf6f0b1dba3cd4d7636498add0833bcf8573cae0fc6eb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86539fd59a4bd35781dcd842e1076166582e506adbcbfb79a775694cae43f1a152f97057dfe2afc184747820626cb97d38bf4384d1c3bdeeb60d1137ca595273
|
7
|
+
data.tar.gz: 269321e3ba8c709733eee3164c4d2d4fe975e93b37cc13dd8b8e39fe28cdccd14fd7ae8a57aa75320da6d1ab3473ea4fd33913a1f8f1038649d51c553469de5f
|
data/lib/snoseeds_palindrome.rb
CHANGED
@@ -2,13 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative "snoseeds_palindrome/version"
|
4
4
|
|
5
|
-
|
6
|
-
# class Error < StandardError; end
|
7
|
-
# # Your code goes here...
|
8
|
-
# end
|
9
|
-
|
10
|
-
class String
|
11
|
-
|
5
|
+
module SnoseedsPalindrome
|
12
6
|
# Returns true for a palindrome, false otherwise.
|
13
7
|
def palindrome?
|
14
8
|
processed_content == processed_content.reverse
|
@@ -18,6 +12,14 @@ class String
|
|
18
12
|
|
19
13
|
# Returns content for palindrome testing.
|
20
14
|
def processed_content
|
21
|
-
scan(/[a-z]/i).join.downcase
|
15
|
+
to_s.scan(/[a-z\d]/i).join.downcase
|
22
16
|
end
|
23
17
|
end
|
18
|
+
|
19
|
+
class String
|
20
|
+
include SnoseedsPalindrome
|
21
|
+
end
|
22
|
+
|
23
|
+
class Integer
|
24
|
+
include SnoseedsPalindrome
|
25
|
+
end
|