bugeater_palindrome 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bugeater_palindrome.rb +10 -6
- data/lib/bugeater_palindrome/version.rb +1 -1
- 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: f4c5bd70c8066361fe2b620d9f5bf33426016e13f1213e56c4bb79e7fbc0ed2f
|
4
|
+
data.tar.gz: b025eb56abbbf1f82bddd0e15daef41dd17f9efe89981b83fa73148a6a3756c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f15aff7e1c5498929e12bd5542bfaa70afefa3235c1d1e9270cf99b56d38639ce2e4ff2cdf665da8e307232d92b97b772a5c6191d25be9f48005e2a228d6adf3
|
7
|
+
data.tar.gz: aefd6947f9b6a0d1372d2f108aeaf0f2358d89825cb5885f0d1c89a0515dad8dd99a5734901d737ab7a8d989d923776f9827a41ac88af34419a181ba55d8755a
|
data/Gemfile.lock
CHANGED
data/lib/bugeater_palindrome.rb
CHANGED
@@ -2,22 +2,26 @@
|
|
2
2
|
|
3
3
|
require_relative "bugeater_palindrome/version"
|
4
4
|
|
5
|
-
|
5
|
+
module BugeaterPalindrome
|
6
6
|
|
7
7
|
# Returns true for a palindrome, false otherwise.
|
8
8
|
def palindrome?
|
9
9
|
processed_content == processed_content.reverse
|
10
10
|
end
|
11
11
|
|
12
|
-
def letters
|
13
|
-
self.scan(/[a-z]/i).join
|
14
|
-
end
|
15
|
-
|
16
12
|
private
|
17
13
|
|
18
14
|
# Returns content for palindrome testing.
|
19
15
|
def processed_content
|
20
|
-
self.
|
16
|
+
self.to_s.scan(/\w/).join.downcase
|
21
17
|
end
|
22
18
|
|
19
|
+
end
|
20
|
+
|
21
|
+
class String
|
22
|
+
include BugeaterPalindrome
|
23
|
+
end
|
24
|
+
|
25
|
+
class Integer
|
26
|
+
include BugeaterPalindrome
|
23
27
|
end
|