tboetto_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: 8b59d5ed9fd779d5d12f96c9ea9245a772827310d327e33d161466d3213691ac
4
- data.tar.gz: e9f4a85cdb5e08d75b284317b6e5820d4f94cea43885d399da656979f7c257ba
3
+ metadata.gz: 2a80f59e203604adec04b8e352a6b8418e7bcd0df28cadc98489cb82f993d661
4
+ data.tar.gz: 14f927cb1f217b4b7c86eb6508e91e22994211fae124363513fa7f4d4b2ce4d0
5
5
  SHA512:
6
- metadata.gz: 9d8dc02b25d370d7e6ec040afea60b49d5d4885a84f3d2c5959d84a7c0c40500348c73e918d013d8025dc08c07da3730c444047eeb7beef1aa92003ae98801ab
7
- data.tar.gz: 983da646cdebd12a421c7ccfd9e1bb609d92d6204b1635ad661ae9713382e6ea55f188901e5172e39f753c36340626f6e8d0be92c82e3bd12bd2d9abd78f6214
6
+ metadata.gz: 5690468e10fc842e596b9ecdab477408b22bc2b827797d408f1ec00bbbb25ef739d5c6fa86464b1316a49ae260c377575631580c89fad38626d6f47382fe5166
7
+ data.tar.gz: 66a1a5185c7badb04420891a4b0aaa9ef10d42c47e32c880f2e471e793fa2a72675bd30d22f394142c04d680166a47f4f6999e4692544afda4043c26a23d0014
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tboetto_palindrome (0.1.0)
4
+ tboetto_palindrome (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module TboettoPalindrome
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,16 +1,30 @@
1
1
  require "tboetto_palindrome/version"
2
2
 
3
3
  # Modify the String class to check for palindromes
4
- class String
4
+ module TboettoPalindrome
5
5
  # Returns true for palindrome, otherwise false.
6
6
  def palindrome?
7
- processed_content == processed_content.reverse
7
+ if processed_content.empty?
8
+ false
9
+ else
10
+ processed_content == processed_content.reverse
11
+ end
8
12
  end
9
13
 
10
14
  private
11
15
 
12
16
  # Processes string/integer to be compared
13
17
  def processed_content
14
- self.scan(/[a-z]/i).join.downcase
18
+ self.to_s.scan(/[a-z0-9]/i).join.downcase
15
19
  end
16
20
  end
21
+
22
+ # Allow for all strings to test for Palindrome's natively
23
+ class String
24
+ include TboettoPalindrome
25
+ end
26
+
27
+ # Allow for integers to test for Palindrome's natively
28
+ class Integer
29
+ include TboettoPalindrome
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tboetto_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
  - Tony Boetto