paco_palindrome 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +30 -0
- data/README.md +47 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/paco_palindrome/version.rb +5 -0
- data/lib/paco_palindrome.rb +18 -0
- data/paco_palindrome.gemspec +43 -0
- data/sig/paco_palindrome.rbs +4 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dbcbd5e1901390c73f7422b03b0079d4ddf21771608ca2513e6cef82d5bcca49
|
4
|
+
data.tar.gz: 1f5eb124559c929723f4c693c1532b0ed968ff36896352bc6420522966a4268c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2fccbebf229fb2fbddba4c72c1e003a2f90626321d2872a939afb76d6a0f541dfffefed381e3942b39b7614b1e9cf6264cb37f78301d0db06080d5a6abc11e11
|
7
|
+
data.tar.gz: 3fc480f3fac4655d15a4fac17fa30f5c03b6123d9c9c9d8329df9e3a7932a4e2aa5962044fa1ed174626c92f6a522e2441ece63c488c392a69d35c039683c4d1
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in paco_palindrome.gemspec
|
6
|
+
gemspec
|
7
|
+
git_source(:github) {|repo_name| "https://github.com/PacoRamosR/paco_palindrome" }
|
8
|
+
gem 'minitest-reporters', '1.2.0'
|
9
|
+
|
10
|
+
gem "rake", "~> 13.0"
|
11
|
+
|
12
|
+
gem "minitest", "~> 5.0"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
paco_palindrome (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ansi (1.5.0)
|
10
|
+
builder (3.2.4)
|
11
|
+
minitest (5.15.0)
|
12
|
+
minitest-reporters (1.2.0)
|
13
|
+
ansi
|
14
|
+
builder
|
15
|
+
minitest (>= 5.0)
|
16
|
+
ruby-progressbar
|
17
|
+
rake (13.0.6)
|
18
|
+
ruby-progressbar (1.11.0)
|
19
|
+
|
20
|
+
PLATFORMS
|
21
|
+
-darwin-21
|
22
|
+
|
23
|
+
DEPENDENCIES
|
24
|
+
minitest (~> 5.0)
|
25
|
+
minitest-reporters (= 1.2.0)
|
26
|
+
paco_palindrome!
|
27
|
+
rake (~> 13.0)
|
28
|
+
|
29
|
+
BUNDLED WITH
|
30
|
+
2.2.33
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# PacoPalindrome
|
2
|
+
|
3
|
+
# Palindrome detector
|
4
|
+
|
5
|
+
`paco_palindrome` is a sample Ruby gem created in [*Learn Enough Ruby to Be Dangerous*](https://www.learnenough.com/ruby-tutorial) by Michael Hartl.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
To install `paco_palindrome`, add this line to your application's `Gemfile`:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem 'paco_palindrome'
|
13
|
+
```
|
14
|
+
|
15
|
+
Then install as follows:
|
16
|
+
|
17
|
+
```
|
18
|
+
$ bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
Or install it directly using `gem`:
|
22
|
+
|
23
|
+
```
|
24
|
+
$ gem install mhartl_palindrome
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
`mhartl_palindrome` adds a `palindrome?` method to the `String` class, and can be used as follows:
|
30
|
+
|
31
|
+
```
|
32
|
+
$ irb
|
33
|
+
>> require 'mhartl_palindrome'
|
34
|
+
>> "honey badger".palindrome?
|
35
|
+
=> false
|
36
|
+
>> "deified".palindrome?
|
37
|
+
=> true
|
38
|
+
>> "Able was I, ere I saw Elba.".palindrome?
|
39
|
+
=> true
|
40
|
+
>> phrase = "Madam, I'm Adam."
|
41
|
+
>> phrase.palindrome?
|
42
|
+
=> true
|
43
|
+
```
|
44
|
+
|
45
|
+
## License
|
46
|
+
|
47
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "paco_palindrome"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "paco_palindrome/version"
|
4
|
+
|
5
|
+
class String
|
6
|
+
|
7
|
+
# Returns true for a palindrome, false otherwise.
|
8
|
+
def palindrome?
|
9
|
+
processed_content == processed_content.reverse
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
# Returns content for palindrome testing.
|
15
|
+
def processed_content
|
16
|
+
scan(/[a-z]/i).join.downcase
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/paco_palindrome/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "paco_palindrome"
|
7
|
+
spec.version = PacoPalindrome::VERSION
|
8
|
+
spec.authors = ["Paco"]
|
9
|
+
spec.email = ["pacodeutrera@hotmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Palindrome detector"
|
12
|
+
spec.description = "Learn Enough Ruby palindrome detector"
|
13
|
+
spec.homepage = "https://github.com/PacoRamosR/paco_palindrome.git"
|
14
|
+
spec.required_ruby_version = ">= 2.5.0"
|
15
|
+
|
16
|
+
if spec.respond_to?(:metadata)
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
18
|
+
else
|
19
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
20
|
+
"public gem pushes."
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
24
|
+
spec.metadata["source_code_uri"] = "https://github.com/PacoRamosR/paco_palindrome.git"
|
25
|
+
|
26
|
+
|
27
|
+
# Specify which files should be added to the gem when it is released.
|
28
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
31
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
spec.bindir = "exe"
|
35
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
36
|
+
spec.require_paths = ["lib"]
|
37
|
+
|
38
|
+
# Uncomment to register a new dependency of your gem
|
39
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
40
|
+
|
41
|
+
# For more information and examples about making a new gem, checkout our
|
42
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paco_palindrome
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paco
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Learn Enough Ruby palindrome detector
|
14
|
+
email:
|
15
|
+
- pacodeutrera@hotmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- Gemfile
|
21
|
+
- Gemfile.lock
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- bin/console
|
25
|
+
- bin/setup
|
26
|
+
- lib/paco_palindrome.rb
|
27
|
+
- lib/paco_palindrome/version.rb
|
28
|
+
- paco_palindrome.gemspec
|
29
|
+
- sig/paco_palindrome.rbs
|
30
|
+
homepage: https://github.com/PacoRamosR/paco_palindrome.git
|
31
|
+
licenses: []
|
32
|
+
metadata:
|
33
|
+
allowed_push_host: https://rubygems.org/
|
34
|
+
homepage_uri: https://github.com/PacoRamosR/paco_palindrome.git
|
35
|
+
source_code_uri: https://github.com/PacoRamosR/paco_palindrome.git
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.5.0
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubygems_version: 3.2.33
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: Palindrome detector
|
55
|
+
test_files: []
|