albopunkaldi_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/README.md +1 -1
- data/lib/albopunkaldi_palindrome/version.rb +1 -1
- data/lib/albopunkaldi_palindrome.rb +11 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce2b6e182bd7806a6f9042b81eb17ed3918f2825cb87c779627bd1aaac49e08c
|
4
|
+
data.tar.gz: 11071d4446838090099d43135b5351e3fdd79bad036662c171908459eb9f31d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '010155295fd65b59ee5549043904fb663cc7f13d7c5d17d8457665b9bec0f8ac710e13353e0a1c0824750dd7c87f8f850e7746598f9ede5330f49729327e230f'
|
7
|
+
data.tar.gz: dbca6c434e3fbbc7c9c906e92091de153ecee6cda4f6d39840fcbbb5ecd6c05f4236504edb0bc148a95beaf1d08d71f393486aa49315811802d8403f79f0384f
|
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,10 +2,11 @@
|
|
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?
|
9
|
+
!processed_content.empty? &&
|
9
10
|
processed_content == processed_content.reverse
|
10
11
|
end
|
11
12
|
|
@@ -13,6 +14,14 @@ class String
|
|
13
14
|
|
14
15
|
# Returns content for palindrome testing.
|
15
16
|
def processed_content
|
16
|
-
scan(/[a-z]/i).join.downcase
|
17
|
+
to_s.scan(/[a-z\d]/i).join.downcase
|
17
18
|
end
|
18
19
|
end
|
20
|
+
|
21
|
+
class String
|
22
|
+
include AlboPunkaldiPalindrome
|
23
|
+
end
|
24
|
+
|
25
|
+
class Integer
|
26
|
+
include AlboPunkaldiPalindrome
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: albopunkaldi_palindrome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alberto Pancaldi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Learn Enough Ruby palindrome detector
|
14
14
|
email:
|