JohnnyNumber5_palindrome 0.1.0 → 0.1.1

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: 19d141152450d77a6b8317394c274b45729558b1c38d073cf6c4ca52b315734d
4
- data.tar.gz: 50714f3252198d9e3982fec75a44004f0ad5d4d664e8363b6afce2bdc9b52725
3
+ metadata.gz: 8235abd62945d424e51663da1915f35c0fd8426fc004d7b2a1616dbac0ed1231
4
+ data.tar.gz: d29aa73fa396b240247c0f4f0ea22fc4f66f917960080ddc5bb493ffc62edfe2
5
5
  SHA512:
6
- metadata.gz: 31b8d3973ae38e5c936b118fa05d452d261121483c40eebb9a19dc7f61f3e27f3aeb802d5a89886f6c8748394478234ba5f6e4ad16929f4fd35cebe6a31fff26
7
- data.tar.gz: 575e58773eb784f8dbf1d84f349ba30a98350e58104e8fd09d35fae56f80c6ac55ba1bd7c833e67e2e7d7f0532cec7ec92225e4d71ca74e56b197612b42a5165
6
+ metadata.gz: f9668ead149614aa3bd002c7ff1ae58fe10074ee48980805cd433d9442f75e7a7cb562ea3c1129d6585968ed8d9560ff35e256d57c5647387e54a7e1ae949dd1
7
+ data.tar.gz: '03621986fb7c7c9eced5a46d5bf71b86c8f7aeab0294f6217ed4f1fe50b94a5f02bfc62b1d8967f84fb6a09414dad1a5f981d062d03e679c308a3ee60370a177'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- JohnnyNumber5_palindrome (0.1.0)
4
+ JohnnyNumber5_palindrome (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,21 +1,25 @@
1
1
  require "JohnnyNumber5_palindrome/version"
2
2
 
3
- class String
3
+ module JohnnyNumber5Palindrome
4
+ class Error < StandardError; end
4
5
 
5
- # Returns true for a palindrome, false otherwise.
6
+ # Returns true if the text is a palindrome, false otherwise.
6
7
  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
8
+ if processed_content.empty?
9
+ false
10
+ else
11
+ processed_content == processed_content.reverse
12
+ end
13
13
  end
14
14
 
15
15
  private
16
16
 
17
- # Returns content for palindrome testing.
18
- def processed_content
19
- scan(/[a-z]/i).join.downcase
20
- end
17
+ # Converts the string's content to lower case.
18
+ def processed_content
19
+ scan(/[a-z]/i).join.downcase
20
+ end
21
+ end
22
+
23
+ class String
24
+ include JohnnyNumber5Palindrome
21
25
  end
@@ -1,3 +1,3 @@
1
1
  module JohnnyNumber5Palindrome
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: JohnnyNumber5_palindrome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nelson