hkendall_palindrome 0.1.0 → 0.2.1
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 +2 -1
- data/lib/hkendall_palindrome/version.rb +1 -1
- data/lib/hkendall_palindrome.rb +32 -20
- 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: 573909fe6905fbf82a7893c1d7bf973c2fadf370ff12dc1a13df5fb915a2e9f3
|
4
|
+
data.tar.gz: 619bbca7f0275d2d4672e04d9d8e17cf016cd1f1b3f3ce61773173150563b060
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 431a27b59a5fa2c14dc40fa7f6d33b732f8e956986ecb8059cdea985e081ad31da4075d76542c6098fb3444bd93a58b4fbf74b8e89f03e07c413a6847354f481
|
7
|
+
data.tar.gz: 8ccf39d0fa0592a4bf6b34840dd73f64f58f38b336db0669d36a2951d89d39a45ec9b430635643c975bf8c2493b36eebd666937d4aa10a752ed2daacde283efb
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hkendall_palindrome (0.1
|
4
|
+
hkendall_palindrome (0.2.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -18,6 +18,7 @@ GEM
|
|
18
18
|
ruby-progressbar (1.13.0)
|
19
19
|
|
20
20
|
PLATFORMS
|
21
|
+
arm64-darwin-21
|
21
22
|
x64-mingw-ucrt
|
22
23
|
|
23
24
|
DEPENDENCIES
|
data/lib/hkendall_palindrome.rb
CHANGED
@@ -1,20 +1,32 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "hkendall_palindrome/version"
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
# Returns true for a palindrome, false otherwise.
|
8
|
-
def palindrome?
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "hkendall_palindrome/version"
|
4
|
+
|
5
|
+
module HkendallPalindrome
|
6
|
+
|
7
|
+
# Returns true for a palindrome, false otherwise.
|
8
|
+
def palindrome?
|
9
|
+
if processed_content.empty?
|
10
|
+
false
|
11
|
+
else
|
12
|
+
processed_content == processed_content.reverse
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# Returns content for palindrome testing.
|
21
|
+
def processed_content
|
22
|
+
to_s.scan(/[a-z0-9]/i).join.downcase
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class String
|
27
|
+
include HkendallPalindrome
|
28
|
+
end
|
29
|
+
|
30
|
+
class Integer
|
31
|
+
include HkendallPalindrome
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hkendall_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
|
- Hunter-Kendall
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Learn Enough Ruby palindrome detector
|
14
14
|
email:
|