studnik18_palindrome 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df1eefca55eddc389bbf4434888d47aae27bfe867ea8352550eeefd4419b99e4
4
- data.tar.gz: c8120a440349f561904b8594ba93480ff8ca968bd5383ba80f813c816de47066
3
+ metadata.gz: cea83755e7e2999563c338acce4d00cb6ab642673005435aa31aaaa8e982e15c
4
+ data.tar.gz: a2b87ca15334aa3fa8d2934af72aef836511a0cb6ed2f74a5bb65e7d69dc609c
5
5
  SHA512:
6
- metadata.gz: 6dcb143ebd95e223f2ff536d17d258f709258fa43c38db146f9dd9ce5b2846234e5f809c620c2049a81ae15584765d3f0c19d14dbc5a7e1f4d55ce665ab7c79a
7
- data.tar.gz: f9a18154cb9bff4d59687d0bd785a6955d725020e632eb2098b784dc1992cb6dc0ce0ebd68ae5da99a9f150f9d054b329d404e95bf0c3cd4b1aef7d1d3018268
6
+ metadata.gz: 7145d5972c96dfaa5e74b9df2e970e271f864f086a5f499cd9e09841c5c3ad62f7fc36424eecd79dcff090c1eccb690194fcb5651dbb8bcfe382e6779d2bdb0e
7
+ data.tar.gz: d509c5fda73ada5dcf817d0c348b73cc6206baceed5a360ff914fd55f40fd7f6464338f611ea004014cc857e89a67456880d310e32590e06b350f9089324f52d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- studnik18_palindrome (0.1.0)
4
+ studnik18_palindrome (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,17 +1,25 @@
1
1
  require "studnik18_palindrome/version"
2
2
 
3
- class String
3
+ module Studnik18Palindrome
4
4
  def palindrome?
5
- processed_content == processed_content.reverse
6
- end
7
-
8
- def letters
9
- self.chars.select { |c| c.match(/[a-z]/i) }.join
5
+ if processed_content.empty?
6
+ false
7
+ else
8
+ processed_content == processed_content.reverse
9
+ end
10
10
  end
11
11
 
12
12
  private
13
13
 
14
14
  def processed_content
15
- self.letters.downcase
15
+ self.to_s.scan(/[a-z0-9]/i).join.downcase
16
16
  end
17
17
  end
18
+
19
+ class String
20
+ include Studnik18Palindrome
21
+ end
22
+
23
+ class Integer
24
+ include Studnik18Palindrome
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Studnik18Palindrome
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: studnik18_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
  - Maciej Studniarz