sstacey_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/sstacey_palindrome/version.rb +1 -1
- data/lib/sstacey_palindrome.rb +10 -3
- 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: ccfa18dd86f3e49cb2a5e2d4375d45fc94bdf85d690f01793e81dcdfe4eb3741
|
4
|
+
data.tar.gz: c32efa08baacbe4297a4f93d2fb9e1b016f8bab0e104f1d6c9fe469a3d2a303b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 254aaa1c4586a6e74f26946ccbdfd996a78784fc225f39ed8cb5cc1a4e67ce99ac4355a92b708690b8839fa71167a01e14b90337d9251e67135804eb0e5b26e9
|
7
|
+
data.tar.gz: 3e9d9c5da07946907de57d4c307c995477f0bea623491595d8111a7570c46663f8429f86ed936cc706b8a5f4c643566cf4301411ee814c8d40e04cd02db3a080
|
data/lib/sstacey_palindrome.rb
CHANGED
@@ -2,14 +2,21 @@
|
|
2
2
|
|
3
3
|
require_relative "sstacey_palindrome/version"
|
4
4
|
|
5
|
-
|
5
|
+
module SstaceyPalindrome
|
6
6
|
def palindrome?
|
7
7
|
processed_content == processed_content.reverse
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
11
|
def processed_content
|
12
|
-
self.scan(/[a-
|
12
|
+
self.to_s.scan(/[a-z0-9]/i).join.downcase
|
13
13
|
end
|
14
|
-
|
14
|
+
end
|
15
|
+
|
16
|
+
class String
|
17
|
+
include SstaceyPalindrome
|
18
|
+
end
|
19
|
+
|
20
|
+
class Integer
|
21
|
+
include SstaceyPalindrome
|
15
22
|
end
|