grh814_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: faf23c39e60e24a18a297c2e64e74d8941c480e8e2aff05acf35d1cb9fae7825
4
- data.tar.gz: 42e1dee6223b2aa3a2ebc5a07467bcbc4613d8673b1325895ffb4a62f81bf174
3
+ metadata.gz: 0114a2db8f27ae01e93f61be503e64e57b71f953c7f9506cf2dd3ba10f11633b
4
+ data.tar.gz: abfcd31ba204c08f7faa25b4a086c63e2c9ef2483260d4c56d79a7b075c06719
5
5
  SHA512:
6
- metadata.gz: 31cea0c9c09da4b6e9f4ab5e97286633abd0825cc871daf8380f90a473f52d657dc4d2c1fa9c815efad4a4f06fbc6fa2d182de621e3e2449e74078a7f7b420f3
7
- data.tar.gz: db59395b4d1b1b9fcf05d416bcffcbcfbb6e20d7e84cdc6faed89ce47526dd877c3e82fcbcabf84e0213dc3b961a36af0931685d74c261e044c05a4561a03da3
6
+ metadata.gz: a51da512af85ae21cc51f93a5a58ab367b8090ba94909f36ad52c18562cb8d2020ab6718eef051e8fa8a2b1f01428b6cc6b4b3ade2966552ef7a59dd8bf09d88
7
+ data.tar.gz: e6f6b6be4911739b30106d1f724fa14d94b82f37d1ca3899846c736ed92891b52618419de4e82ed8a8a3b169f89c93545d79ba33f0fd1f0cf635fbe5f92450d3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grh814_palindrome (0.1.0)
4
+ grh814_palindrome (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,21 +1,28 @@
1
1
  require "grh814_palindrome/version"
2
2
 
3
- class String
3
+ module Grh814Palindrome
4
4
 
5
5
  # Returns true for a palindrome, false otherwise.
6
6
  def palindrome?
7
- processed_content == processed_content.reverse
8
- end
9
-
10
- # Returns the letters in the string.
11
- def letters
12
- self.chars.select { |c| c.match(/[a-z]/i) }.join
7
+ if processed_content.empty?
8
+ false
9
+ else
10
+ processed_content == processed_content.reverse
11
+ end
13
12
  end
14
13
 
15
14
  private
16
15
 
17
- # Returns content for palindrome testing.
16
+ # Returns the content for palindrome testing.
18
17
  def processed_content
19
- self.scan(/[a-z]/i).join.downcase
18
+ self.to_s.scan(/[a-z\d]/i).join.downcase
20
19
  end
21
20
  end
21
+
22
+ class String
23
+ include Grh814Palindrome
24
+ end
25
+
26
+ class Integer
27
+ include Grh814Palindrome
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Grh814Palindrome
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: grh814_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
  - Geoffrey Hahn