chap8_ex_gem_palindrome 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +1 -1
- data/chap8_ex_gem_palindrome.gemspec +2 -6
- data/lib/chap8_ex_gem_palindrome/version.rb +1 -1
- data/lib/chap8_ex_gem_palindrome.rb +15 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1786ac8e9766be3749b2dba55abe2c5cfc670dca24968dd18c33993e8ee50456
|
4
|
+
data.tar.gz: a4c44a30a8da0b5a94e63c4b6cf9410c6b45a90db9dc5d4858d069634503a6e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6de3ebc6949a1c2d83b751a99ffca5c646520df106e0ae8a76534aa245ace9e5751010b8b792a0a45a1ff713eb5b089aa3c438e75b1afa6ca1f1f8cf619eefce
|
7
|
+
data.tar.gz: 2bf8f847a73717162fda823ff2f12bc165d21eb182ae347d4006a7264e8a6eff8553863f8a116595b1c9ce6f3753a38c809561181c2b45d817e5155725346ea2
|
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
6
|
|
7
7
|
# Specify your gem's dependencies in chap8_ex_gem_palindrome.gemspec
|
8
8
|
gemspec
|
@@ -13,4 +13,4 @@ gem "minitest", "~> 5.0"
|
|
13
13
|
|
14
14
|
gem "rubocop", "~> 1.21"
|
15
15
|
|
16
|
-
gem
|
16
|
+
gem "minitest-reporters", "1.2.0"
|
data/Gemfile.lock
CHANGED
@@ -8,13 +8,11 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Xeniouska"]
|
9
9
|
spec.email = ["115425494+Xeniouska@users.noreply.github.com"]
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = "Palindrome detector"
|
12
|
+
spec.description = "Learn Enough Ruby palindrome detector"
|
13
13
|
spec.homepage = "https://github.com/mhartl/mhartl_palindrome"
|
14
14
|
spec.required_ruby_version = ">= 2.6.0"
|
15
15
|
|
16
|
-
|
17
|
-
|
18
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the
|
19
17
|
# 'allowed_push_host'
|
20
18
|
# to allow pushing to a single host or delete this section to allow pushing to
|
@@ -32,8 +30,6 @@ Gem::Specification.new do |spec|
|
|
32
30
|
# spec.metadata["source_code_uri"] = spec.homepage
|
33
31
|
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
34
32
|
|
35
|
-
|
36
|
-
|
37
33
|
# Specify which files should be added to the gem when it is released.
|
38
34
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
39
35
|
spec.files = Dir.chdir(__dir__) do
|
@@ -1,28 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Version 0.2.
|
3
|
+
# Version 0.2.1
|
4
4
|
|
5
5
|
require_relative "chap8_ex_gem_palindrome/version"
|
6
6
|
|
7
|
+
# Test for palindroms
|
7
8
|
module Chap8ExGemPalindrome
|
8
|
-
|
9
9
|
# Returns true for a palindrome, false otherwise.
|
10
10
|
def palindrome?
|
11
|
-
|
11
|
+
if processed_content.empty?
|
12
|
+
false
|
13
|
+
else
|
14
|
+
processed_content == processed_content.reverse
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
private
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
+
# Returns content for palindrome testing.
|
21
|
+
def processed_content
|
22
|
+
scan(/[a-z0-9]/i).join.downcase
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
class String
|
23
27
|
include Chap8ExGemPalindrome
|
24
28
|
end
|
25
29
|
|
30
|
+
class Integer
|
31
|
+
include Chap8ExGemPalindrome
|
32
|
+
end
|
33
|
+
|
26
34
|
# class String
|
27
35
|
|
28
36
|
# # Returns true for a palindrome, false otherwise.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chap8_ex_gem_palindrome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xeniouska
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Learn Enough Ruby palindrome detector
|
14
14
|
email:
|