crashmat_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/lib/crashmat_palindrome/version.rb +1 -1
- data/lib/crashmat_palindrome.rb +10 -13
- 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: 2d66772e7a10d687c4b3102d633d4bd2e0cb4a9e7483d064721236bd92c07b66
|
4
|
+
data.tar.gz: 3578fd607432cb36848d69dc98791ad510e3ded21d8cd03e00a18c1157bfa9ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cfc6b43d1c1443e9ed4142138843602d1e0dc48fee147950a7539f5084336f5aa9a78b2a35a8dc3c7d3c9aa90695414d02e37730aa531e2a74c79cd50a423df
|
7
|
+
data.tar.gz: de903315c3c1fd06546c871e55ce0cd64af89b76a366224bb56b87a709eadf4167ff35c5bd668a72198cd858d38cd6dfc93fb37289181654e74d32ec109da725
|
data/lib/crashmat_palindrome.rb
CHANGED
@@ -2,28 +2,25 @@
|
|
2
2
|
|
3
3
|
require_relative "crashmat_palindrome/version"
|
4
4
|
|
5
|
-
|
5
|
+
module CrashmatPalindrome
|
6
6
|
|
7
7
|
# Returns true for a palindrome, false otherwise.
|
8
8
|
def palindrome?
|
9
9
|
processed_content == processed_content.reverse
|
10
10
|
end
|
11
11
|
|
12
|
-
# Returns the letters of a string
|
13
|
-
def letters
|
14
|
-
the_letters = []
|
15
|
-
for i in 0..self.length - 1
|
16
|
-
if self[i].match(/[a-zA-Z]/)
|
17
|
-
the_letters << self[i]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
the_letters.join
|
21
|
-
end
|
22
|
-
|
23
12
|
private
|
24
13
|
|
25
14
|
# Returns content for palindrome testing.
|
26
15
|
def processed_content
|
27
|
-
|
16
|
+
to_s.scan(/[a-z\d]/i).join.downcase
|
28
17
|
end
|
29
18
|
end
|
19
|
+
|
20
|
+
class String
|
21
|
+
include CrashmatPalindrome
|
22
|
+
end
|
23
|
+
|
24
|
+
class Integer
|
25
|
+
include CrashmatPalindrome
|
26
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crashmat_palindrome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- crashmat
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-30 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: "%q{Learn Enough Ruby plaindrome detector}"
|
13
13
|
email:
|