agustin_palindrome 0.1.0 → 0.3.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: 852ae21ed83a6641461990148ef6f475f64bed07b6f893ec5c841e37d5f527fe
4
- data.tar.gz: 552a1be98c2e95c035037428aa9f3f8c677ea5a7bf08792114afb82a645701f5
3
+ metadata.gz: eff0bcb4b678ccb4df670b4130b695be5cc5a8a3cf5ca3ba235b8767d1276620
4
+ data.tar.gz: 072e65470d6a9abe19f9d6e9128b26baccd10cf30641d11bc4447d95e35536fe
5
5
  SHA512:
6
- metadata.gz: f974c687c6a83069f232b47b8ed41f71bd4945746762efc42030511a65c45310c57fcd261c14fd7c2b577bf27ea63427c9927f6d3495d5852a63b483e260aab8
7
- data.tar.gz: f22ec3508d63380351065ac19982c506c14ead14d420e14f2c15855168f19627d64dc1fb74642ad129185a2b76d962768f746dc8c73047b5505e26fe1a1ddb54
6
+ metadata.gz: fab0fecd013faf532447b69c5ddff7bcd3560895a1b452b3f9d4b8f3fc546619555977dd00c285e0b199f763adea741ce33db85d95c07647ac19316dab5ef9e0
7
+ data.tar.gz: 36b8749287784d2bc26988564e8e1645fd944c577c7df863709e1eb47e1c4d54d5cceffb964c0d6e3af9c244cbf663f04fd228b45b48837350a9491bf771e221
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- agustin_palindrome (0.1.0)
4
+ agustin_palindrome (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -24,7 +24,7 @@ $ gem install agustin_palindrome
24
24
 
25
25
  ## Usage
26
26
 
27
- `agustin_palindrome` adds a `palindrome?` method to the `String` class, and can be used as follows:
27
+ `agustin_palindrome` adds a `palindrome?` method to the `String` and to the `Integer` class, and can be used as follows:
28
28
 
29
29
  ```
30
30
  $ irb
@@ -38,6 +38,10 @@ $ irb
38
38
  >> phrase = "Madam, I'm Adam."
39
39
  >> phrase.palindrome?
40
40
  => true
41
+ >> 12345.palindrome?
42
+ => false
43
+ >> 1234321.palindrome?
44
+ => true
41
45
  ```
42
46
 
43
47
  ## License
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AgustinPalindrome
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -2,18 +2,24 @@
2
2
 
3
3
  require_relative "agustin_palindrome/version"
4
4
 
5
- class String
5
+ module AgustinPalindrome
6
6
  def palindrome?
7
+ return false if processed_content.empty?
8
+
7
9
  processed_content == processed_content.reverse
8
10
  end
9
11
 
10
- def letters
11
- scan(/[a-z]/i).join
12
- end
13
-
14
12
  private
15
13
 
16
14
  def processed_content
17
- letters.downcase
15
+ to_s.scan(/[a-z\d]/i).join.downcase
18
16
  end
19
17
  end
18
+
19
+ class String
20
+ include AgustinPalindrome
21
+ end
22
+
23
+ class Integer
24
+ include AgustinPalindrome
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agustin_palindrome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AgustinPalmaM
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-14 00:00:00.000000000 Z
11
+ date: 2023-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler