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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/studnik18_palindrome.rb +15 -7
- data/lib/studnik18_palindrome/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea83755e7e2999563c338acce4d00cb6ab642673005435aa31aaaa8e982e15c
|
4
|
+
data.tar.gz: a2b87ca15334aa3fa8d2934af72aef836511a0cb6ed2f74a5bb65e7d69dc609c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7145d5972c96dfaa5e74b9df2e970e271f864f086a5f499cd9e09841c5c3ad62f7fc36424eecd79dcff090c1eccb690194fcb5651dbb8bcfe382e6779d2bdb0e
|
7
|
+
data.tar.gz: d509c5fda73ada5dcf817d0c348b73cc6206baceed5a360ff914fd55f40fd7f6464338f611ea004014cc857e89a67456880d310e32590e06b350f9089324f52d
|
data/Gemfile.lock
CHANGED
data/lib/studnik18_palindrome.rb
CHANGED
@@ -1,17 +1,25 @@
|
|
1
1
|
require "studnik18_palindrome/version"
|
2
2
|
|
3
|
-
|
3
|
+
module Studnik18Palindrome
|
4
4
|
def palindrome?
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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.
|
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
|