heo_palindrome 0.1.0 → 0.1.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/heo_palindrome.gemspec +39 -0
- data/lib/heo_palindrome/version.rb +1 -1
- data/lib/heo_palindrome.rb +14 -5
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7816b40173849b8a46f666c2245e3073faef065dc09f591657291c010487488d
|
4
|
+
data.tar.gz: f34c017c9cc30d508f63c2ba0df90b5f60311fe11ee0e94711cf9ca90c037b1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18798f62cc8dd1e18fee574f3ae8bc301370de63ffb2a88630e4980fa46b971e71e518893d996d75f2afd6d07e387dcb78628911a55895e38a03c50376929f91
|
7
|
+
data.tar.gz: 3a9ee162a9daf81e36db3c1bcaeadc3d766dde9c9491d46aeff1442a49dbd4c7cc494111917b7255687d51351a599388ec1563b1f0a2c5e85d13c5f881c5e753
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/heo_palindrome/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "heo_palindrome"
|
7
|
+
spec.version = HeoPalindrome::VERSION
|
8
|
+
spec.authors = ["heo001997"]
|
9
|
+
spec.email = ["heo001997@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Palindrome detector}
|
12
|
+
spec.description = %q{Learn Enough Ruby palindrome detector}
|
13
|
+
spec.homepage = "https://github.com/heo001997/ruby-heo-palindrome"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/heo001997/ruby-heo-palindrome"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/heo001997/ruby-heo-palindrome/blob/main/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(__dir__) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, check out our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
end
|
data/lib/heo_palindrome.rb
CHANGED
@@ -2,22 +2,31 @@
|
|
2
2
|
|
3
3
|
require_relative "heo_palindrome/version"
|
4
4
|
|
5
|
-
|
5
|
+
module HeoPalindrome
|
6
6
|
|
7
7
|
# Returns true for a palindrome, false otherwise.
|
8
8
|
def palindrome?
|
9
|
-
processed_content
|
9
|
+
processed_content.size > 0 &&
|
10
|
+
processed_content == processed_content.reverse
|
10
11
|
end
|
11
12
|
|
12
13
|
# Returns the letters in the string.
|
13
|
-
def
|
14
|
-
|
14
|
+
def letters_and_numbers
|
15
|
+
to_s.scan(/[a-z0-9]/i).join
|
15
16
|
end
|
16
17
|
|
17
18
|
private
|
18
19
|
|
19
20
|
# Returns content for palindrome testing.
|
20
21
|
def processed_content
|
21
|
-
self.
|
22
|
+
self.letters_and_numbers.downcase
|
22
23
|
end
|
23
24
|
end
|
25
|
+
|
26
|
+
class Integer
|
27
|
+
include HeoPalindrome
|
28
|
+
end
|
29
|
+
|
30
|
+
class String
|
31
|
+
include HeoPalindrome
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heo_palindrome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- heo001997
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- LICENSE.txt
|
26
26
|
- README.md
|
27
27
|
- Rakefile
|
28
|
+
- heo_palindrome.gemspec
|
28
29
|
- lib/heo_palindrome.rb
|
29
30
|
- lib/heo_palindrome/version.rb
|
30
31
|
- sig/heo_palindrome.rbs
|