albopunkaldi_palindrome 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/albopunkaldi_palindrome/version.rb +1 -1
- data/lib/albopunkaldi_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: a8c241a406f59277013c62c80f6575a48dec103641f858e2ef1aaeb9ddb962b4
|
4
|
+
data.tar.gz: 6c7ae976406f96a2befe52bc27b206a56a67ce2fd4c507e6560101d1eb8e0927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f6d71658b596d8bc3abeed24320449707fe2bd3f8371cfe8a32b21055a4bc471e665dbbfbdc91714bbe679a44ee880975ca2a1bb19eed555cdec3d4ae49e741
|
7
|
+
data.tar.gz: b5ec84133b9b8276734ce3057b6b38e92d0c64dbc40503d47a83e887bec261fabaccfb80e6dd2f13f200a3e5e7872ba09e43a0f4e09e9a68aa91a308e07922ea
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
`albopunkaldi_palindrome` is a sample Ruby gem created in [*Learn Enough Ruby to Be Dangerous*](https://www.learnenough.com/ruby-tutorial) by Alberto Pancaldi.
|
4
4
|
|
5
|
-
The purpose of this gem is to detect if
|
5
|
+
The purpose of this gem is to detect if strings or integer are palindrome or not.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative "albopunkaldi_palindrome/version"
|
4
4
|
|
5
|
-
|
5
|
+
module AlboPunkaldiPalindrome
|
6
6
|
|
7
7
|
# Returns true for a palindrome, false otherwise.
|
8
8
|
def palindrome?
|
@@ -13,6 +13,14 @@ class String
|
|
13
13
|
|
14
14
|
# Returns content for palindrome testing.
|
15
15
|
def processed_content
|
16
|
-
scan(/[a-z]/i).join.downcase
|
16
|
+
to_s.scan(/[a-z\d]/i).join.downcase
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
class String
|
21
|
+
include AlboPunkaldiPalindrome
|
22
|
+
end
|
23
|
+
|
24
|
+
class Integer
|
25
|
+
include AlboPunkaldiPalindrome
|
26
|
+
end
|