albertoms_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: e3aa0f44b180ab98d4f024d84e27b2c2328bdc50c1b3e834e8be7605d1f6c5c9
4
- data.tar.gz: 6367404515d9a0aed292b9681664b316fb011674a806ddc43f159cd31e9022a5
3
+ metadata.gz: 7b648085399a38a32a1d66c164cba8f7ceac043175ee6866bb8fef5bbb963ec8
4
+ data.tar.gz: 2f2cb82e69431c1ff86bbd570e643211e5aa3879e7f44a8a2bc92932c56c2e23
5
5
  SHA512:
6
- metadata.gz: 213d97ddf516faaf541fd6e1aa8d9558097aa9ce10a93508a4674b44ab7a93bbd3f576d1b0bffa7e646455897743515278e633a44df1fe66e41a2f414028007a
7
- data.tar.gz: c1f4c689361d8d7b83c88439afebac96698486d30b74ee439a273c1f3cb457b96fc309355536c141461383cac9b29d669e0562dea581d982b4607a31e27574dd
6
+ metadata.gz: 998f125007d168206e65708f0bd0493abff20bd1115ad711029149e58bf32b3f1451afb33f1ec1b5177013d96878febcebd064e16e6df6cbfe8d1c7771bfae3a
7
+ data.tar.gz: 31438a592a0379a4b7c7c0807c25313ca24ec8a4494ae55b309aea487598dc5fab3df48a625def5ac2d7709f792835e3a8490d51f44793936850d58ed60f817d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- albertoms_palindrome (0.1.0)
4
+ albertoms_palindrome (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AlbertomsPalindrome
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,26 +1,29 @@
1
1
  require "albertoms_palindrome/version"
2
2
 
3
- # module AlbertomsPalindrome
4
- # class Error < StandardError; end
5
- # # Your code goes here...
6
- # end
7
-
8
- class String
9
-
3
+ module AlbertomsPalindrome
4
+ class Error < StandardError; end
5
+
10
6
  # Returns true if the text is a palindrome, false otherwise.
11
7
  def palindrome?
12
- processed_content == processed_content.reverse
8
+ if processed_content.empty?
9
+ false
10
+ else
11
+ processed_content == processed_content.reverse
12
+ end
13
13
  end
14
14
 
15
- # Returns the letters in the string.
16
- # def letters
17
- # self.chars.select { |c| c.match(/[a-z]/i) }.join
18
- # end
19
-
20
15
  private
21
16
 
22
- # Converts the string's content to lower case.
17
+ # Format content for palindrome testing
23
18
  def processed_content
24
- scan(/[a-z]/i).join.downcase
19
+ to_s.scan(/[a-z\d]/i).join.downcase
25
20
  end
26
21
  end
22
+
23
+ class String
24
+ include AlbertomsPalindrome
25
+ end
26
+
27
+ class Integer
28
+ include AlbertomsPalindrome
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: albertoms_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
  - Luis Guerrero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-09 00:00:00.000000000 Z
11
+ date: 2020-04-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Was it a car or a cat I saw? — A palindrome detector.
14
14
  email: