bhouy_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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d13bfbae16267bb3438717961431c98fa6a0ceed4e3f0ec360f67631a7a3639
4
- data.tar.gz: 48637156126ad9ddf32070fad6fe6f493a2f1295f203c7dd0998e9a7bdb87bcb
3
+ metadata.gz: 4f1eaff42b591892a07b1255cf256cc9b706a0e38326af82b490a6f405277a52
4
+ data.tar.gz: 63433c8bedf39f90b48cedfe0c6ac61ddbfc16beb58b3b0e764ca48b42ddddfe
5
5
  SHA512:
6
- metadata.gz: bebaa4dc00f1366801376b242014199533eb8085d3e5a01f480eca78576734a0ec192f8f0c66ab075ad23765ab0902f8921cd2c9e674478fef3e4c425c1e5957
7
- data.tar.gz: efdc93662d5d83eda241878086b5a73b35c83ccda6e4df0fba5bb8efc1faab085a63e39c117d5740b2080b19c37d63519b2e1963baa579c487649e1bda213fe8
6
+ metadata.gz: 7dff932e5093acfb29303f0292b9b9d46422368f61fa4f521e36134a1b2cfb8a3fcd42df4a1d8efb43ea7cc6bdbe6e8b6c7431103b54a22546018e35841aa639
7
+ data.tar.gz: f1959a17ac03d112920368c84f90caf54c22a1e4a396d0a3f04bd2274452fc5a0841e83f6d9b75bc60b39bbb732b2ac6a16cdb807adee106029257d2860a8acc
@@ -1,9 +1,9 @@
1
1
  require_relative "bhouy_palindrome/version"
2
2
 
3
- class String
4
3
 
5
- # Returns true for a palindrome, false otherwise.
6
- def palindrome?
4
+ module BhouyPalindrome
5
+ # Returns true for a palindrome, false otherwise.
6
+ def palindrome?
7
7
  processed_content == processed_content.reverse
8
8
  end
9
9
 
@@ -11,10 +11,18 @@ class String
11
11
 
12
12
  # Returns content for palindrome testing.
13
13
  def processed_content
14
- scan(/[a-zA-Z]/i).join.downcase
14
+ to_s.scan(/[a-zA-Z\d]/i).join.downcase
15
15
  end
16
16
  end
17
17
 
18
+ class String
19
+ include BhouyPalindrome
20
+ end
21
+
22
+ class Integer
23
+ include BhouyPalindrome
24
+ end
25
+
18
26
 
19
27
 
20
28
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BhouyPalindrome
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bhouy_palindrome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Houy