mqhz_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: aa0e8f211cccc85e46134f6bfba797a1a1c466b0d98a5088fdb74b4b6182a526
4
- data.tar.gz: 0f607ab47a44915002d212b8ad708e55444d2dd7605ea19b8084ae7d2a91adb8
3
+ metadata.gz: 673b86055af70ffd4266f67de192dca1f27d4199b5187a9ce69790d78be67acd
4
+ data.tar.gz: f491a3d9a80234ed08b7ec3b5d78332750494c98808610787efdfa4c67d36000
5
5
  SHA512:
6
- metadata.gz: f00fb77a5598ebb55370aeb186e93824f081ce5240d8c189a18ddce234931fc9a75d2dc4381daccebffde9495a8496a8e8ddaf6ee827a83a90df786d090bda32
7
- data.tar.gz: 4d01fa8e668738324bd50abbeaa4590ec0382bcfd3549240b0b0d864c493fc536770c8a8d961f5656d1a495e4ca800771e49ca90c487547746d01ff2c9083a56
6
+ metadata.gz: bddf4dd3a90008c89ff0173b540959585d925422f1b9a6137927085e325a5c7e9b030983284bcd57ab4fc69c6c218f7717ee856fda173381e8fcf84c223bdb40
7
+ data.tar.gz: '091fb7286f49a3caf1dfd79a36add1b2f926b093e5ae26894e272ac1b96b90d7ade76799517503fc86fea1c10b1ad911cc883534a2def95fb6804bd8068381d0'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mqhz_palindrome (0.1.0)
4
+ mqhz_palindrome (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,12 +1,26 @@
1
1
  require "mqhz_palindrome/version"
2
2
 
3
- class String
3
+ module MqhzPalindrome
4
+ #Returns true for a palindrome, false otherwise.
4
5
  def palindrome?
6
+ if processed_content.empty?
7
+ false
8
+ else
5
9
  processed_content == processed_content.reverse
10
+ end
6
11
  end
7
-
8
12
  private
13
+ #Returns content for palindrome testing.
9
14
  def processed_content
10
- self.scan(/[a-z]/i).join.downcase
15
+ self.to_s.scan(/[a-z]|\d/i).join.downcase
11
16
  end
12
17
  end
18
+
19
+ #Add palindrome functionality to the string class.
20
+ class String
21
+ include MqhzPalindrome
22
+ end
23
+ #Add palindrome functionality to the integer class.
24
+ class Integer
25
+ include MqhzPalindrome
26
+ end
@@ -1,3 +1,3 @@
1
1
  module MqhzPalindrome
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mqhz_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
  - QUAYAM