ilyass_palindrome 0.1.0 → 1.0.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/CHANGELOG.md +5 -1
- data/lib/ilyass_palindrome/version.rb +1 -1
- data/lib/ilyass_palindrome.rb +15 -7
- 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: 6ce73b5a28dae2ad32fab1660f1347cab2ff805d9eac10e37d44950139e4410e
|
4
|
+
data.tar.gz: 1516dc6ddf5869b83838fd600e67888d3a8ae83abf24eb067a3c0879542e2694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f394305f79a3f052b300f5157e25be7d68d9e2bde55bf1470fea5d37c90c4ad12a61d069a796bd5cf3a308ff7de56511c04301c9074d90548c00c42c4c7830de
|
7
|
+
data.tar.gz: 9446f22433444f91556ec20a036de3c8185d9c5a30f58e1e6badabe2f282126480e865b7ddaa3931ae7070c5f99ac70da625715ce568fb7717c0c744d6081ced
|
data/CHANGELOG.md
CHANGED
@@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
-
## [
|
8
|
+
## [0.1.0]
|
9
9
|
- Added: Initial implementation of palindrome checking functionality.
|
10
|
+
- Support for String class.
|
11
|
+
## [0.1.0]
|
12
|
+
- `palindrome?` now support both the String and Integer classes.
|
13
|
+
- This version is for professional use.
|
10
14
|
|
11
15
|
|
data/lib/ilyass_palindrome.rb
CHANGED
@@ -2,20 +2,28 @@
|
|
2
2
|
|
3
3
|
require_relative "ilyass_palindrome/version"
|
4
4
|
|
5
|
-
|
5
|
+
module IlyassPalindrome
|
6
6
|
# Returns true for a palinfrome, false otherwise.
|
7
7
|
def palindrome?
|
8
|
-
|
8
|
+
if processed_content.empty?
|
9
|
+
false
|
10
|
+
else
|
11
|
+
processed_content == processed_content.reverse
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
private
|
12
16
|
|
13
17
|
# Returns content for palindrome testing
|
14
18
|
def processed_content
|
15
|
-
self.scan(/[a-
|
19
|
+
self.to_s.scan(/[a-z0-9]/i).join.downcase
|
16
20
|
end
|
17
21
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
|
23
|
+
class String
|
24
|
+
include IlyassPalindrome
|
25
|
+
end
|
26
|
+
|
27
|
+
class Integer
|
28
|
+
include IlyassPalindrome
|
29
|
+
end
|