edgar_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/edgar_palindrome/version.rb +1 -1
- data/lib/edgar_palindrome.rb +12 -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: 3ddbb8d190136ea3d17de37bc5729121e7fb656d3fe2fd47c670f79210bae428
|
4
|
+
data.tar.gz: 3f7b2b6f7f99988088447f400ace2061044247508850fc20dccddd15682c110b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d771828ab5d0ccb8296c7f96bec095cde81b437b9a46f55fcc87664fb66182f576294e06a87be9d6f5916e4a2e98233f678983da1c500e03687643249f718b7
|
7
|
+
data.tar.gz: 3861d601bcaa98912b978a91e6b5ca268ea4789094afa4eceb2c372061147746f0b6b96538c187b1ba2f99cd1fa55ffc8cce787e10aa6c8460c4b919cb61df90
|
data/lib/edgar_palindrome.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "edgar_palindrome/version"
|
2
2
|
|
3
|
-
|
3
|
+
module EdgarPalindrome
|
4
4
|
|
5
5
|
# Returns true for a palindrome, false otherwise.
|
6
6
|
def palindrome?
|
@@ -8,13 +8,22 @@ class String
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def letters
|
11
|
-
self.scan(/[a-zA-Z]/).join
|
11
|
+
self.scan(/[a-zA-Z\d]/).join
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
16
|
# Returns content for palindrome testing.
|
17
17
|
def processed_content
|
18
|
-
self.downcase.letters
|
18
|
+
self.to_s.downcase.letters
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
class String
|
23
|
+
include EdgarPalindrome
|
24
|
+
end
|
25
|
+
|
26
|
+
class Integer
|
27
|
+
include EdgarPalindrome
|
28
|
+
end
|
29
|
+
|