eclectic_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/.gitignore +134 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +30 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/eclectic_palindrome.gemspec +29 -0
- data/lib/eclectic_palindrome.rb +21 -0
- data/lib/eclectic_palindrome/version.rb +3 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 23e3725a0d61d6149d15bd138cf106a27e935a5877070824ff134465dabfb0e5
|
4
|
+
data.tar.gz: 881ecdbd375eb7307793cfad4339f8d7626883ffccd13ee7a48a1b732f4eb02d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d10f68d3a8ac19de311550c4f355eb7e9c25aace16c92b14c9676084c67627c22fbc1ae0e485b3a889cf3b18a5e19b86f2b9ac8435b906820762c463bfafc2e5
|
7
|
+
data.tar.gz: 360409ac5a57929dfb2d09520b313a20e939236a49fead1e48e300b3355eeb8a360d6fb01d7c42e1151c74ca2bd4a39b7fdb6feb8b07ad4fef4a0d5a179f4282
|
data/.gitignore
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
|
10
|
+
# Created by https://www.gitignore.io/api/ruby,rails
|
11
|
+
# Edit at https://www.gitignore.io/?templates=ruby,rails
|
12
|
+
|
13
|
+
### Rails ###
|
14
|
+
*.rbc
|
15
|
+
capybara-*.html
|
16
|
+
.rspec
|
17
|
+
/db/*.sqlite3
|
18
|
+
/db/*.sqlite3-journal
|
19
|
+
/public/system
|
20
|
+
/coverage/
|
21
|
+
/spec/tmp
|
22
|
+
*.orig
|
23
|
+
rerun.txt
|
24
|
+
pickle-email-*.html
|
25
|
+
|
26
|
+
# Ignore all logfiles and tempfiles.
|
27
|
+
/log/*
|
28
|
+
/tmp/*
|
29
|
+
!/log/.keep
|
30
|
+
!/tmp/.keep
|
31
|
+
|
32
|
+
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
|
33
|
+
config/initializers/secret_token.rb
|
34
|
+
config/master.key
|
35
|
+
|
36
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
37
|
+
# config/secrets.yml
|
38
|
+
|
39
|
+
# dotenv
|
40
|
+
# TODO Comment out this rule if environment variables can be committed
|
41
|
+
.env
|
42
|
+
|
43
|
+
## Environment normalization:
|
44
|
+
/.bundle
|
45
|
+
/vendor/bundle
|
46
|
+
|
47
|
+
# these should all be checked in to normalize the environment:
|
48
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
49
|
+
|
50
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
|
+
.rvmrc
|
52
|
+
|
53
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
54
|
+
/vendor/assets/bower_components
|
55
|
+
*.bowerrc
|
56
|
+
bower.json
|
57
|
+
|
58
|
+
# Ignore pow environment settings
|
59
|
+
.powenv
|
60
|
+
|
61
|
+
# Ignore Byebug command history file.
|
62
|
+
.byebug_history
|
63
|
+
|
64
|
+
# Ignore node_modules
|
65
|
+
node_modules/
|
66
|
+
|
67
|
+
# Ignore precompiled javascript packs
|
68
|
+
/public/packs
|
69
|
+
/public/packs-test
|
70
|
+
/public/assets
|
71
|
+
|
72
|
+
# Ignore yarn files
|
73
|
+
/yarn-error.log
|
74
|
+
yarn-debug.log*
|
75
|
+
.yarn-integrity
|
76
|
+
|
77
|
+
# Ignore uploaded files in development
|
78
|
+
/storage/*
|
79
|
+
!/storage/.keep
|
80
|
+
|
81
|
+
### Ruby ###
|
82
|
+
*.gem
|
83
|
+
/.config
|
84
|
+
/InstalledFiles
|
85
|
+
/pkg/
|
86
|
+
/spec/reports/
|
87
|
+
/spec/examples.txt
|
88
|
+
/test/tmp/
|
89
|
+
/test/version_tmp/
|
90
|
+
/tmp/
|
91
|
+
|
92
|
+
# Used by dotenv library to load environment variables.
|
93
|
+
# .env
|
94
|
+
|
95
|
+
# Ignore Byebug command history file.
|
96
|
+
|
97
|
+
## Specific to RubyMotion:
|
98
|
+
.dat*
|
99
|
+
.repl_history
|
100
|
+
build/
|
101
|
+
*.bridgesupport
|
102
|
+
build-iPhoneOS/
|
103
|
+
build-iPhoneSimulator/
|
104
|
+
|
105
|
+
## Specific to RubyMotion (use of CocoaPods):
|
106
|
+
#
|
107
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
108
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
109
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
110
|
+
# vendor/Pods/
|
111
|
+
|
112
|
+
## Documentation cache and generated files:
|
113
|
+
/.yardoc/
|
114
|
+
/_yardoc/
|
115
|
+
/doc/
|
116
|
+
/rdoc/
|
117
|
+
|
118
|
+
/.bundle/
|
119
|
+
/lib/bundler/man/
|
120
|
+
|
121
|
+
# for a library or gem, you might want to ignore these files since the code is
|
122
|
+
# intended to run in multiple environments; otherwise, check them in:
|
123
|
+
# Gemfile.lock
|
124
|
+
# .ruby-version
|
125
|
+
# .ruby-gemset
|
126
|
+
|
127
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
128
|
+
|
129
|
+
### Ruby Patch ###
|
130
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
131
|
+
# .rubocop-https?--*
|
132
|
+
|
133
|
+
# End of https://www.gitignore.io/api/ruby,rails
|
134
|
+
n
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at chuck@eclecticsaddlebag.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
eclectic_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.14.1)
|
12
|
+
minitest-reporters (1.4.2)
|
13
|
+
ansi
|
14
|
+
builder
|
15
|
+
minitest (>= 5.0)
|
16
|
+
ruby-progressbar
|
17
|
+
rake (12.3.3)
|
18
|
+
ruby-progressbar (1.10.1)
|
19
|
+
|
20
|
+
PLATFORMS
|
21
|
+
ruby
|
22
|
+
|
23
|
+
DEPENDENCIES
|
24
|
+
eclectic_palindrome!
|
25
|
+
minitest (~> 5.0)
|
26
|
+
minitest-reporters
|
27
|
+
rake (~> 12.0)
|
28
|
+
|
29
|
+
BUNDLED WITH
|
30
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 eclectic-coding
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Palindrome detector
|
2
|
+
|
3
|
+
`eclectic_palindrome` is a sample Ruby gem created in [*Learn Enough Ruby to Be Dangerous*](https://www.learnenough.com/ruby-tutorial) by Michael Hartl.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
To install `eclectic_palindrome`, add this line to your application's `Gemfile`:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'eclectic_palindrome'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then install as follows:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it directly using `gem`:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ gem install eclectic_palindrome
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
`eclectic_palindrome` adds a `palindrome?` method to the `String` class, and can be used as follows:
|
28
|
+
|
29
|
+
```
|
30
|
+
$ irb
|
31
|
+
>> require 'eclectic_palindrome'
|
32
|
+
>> "honey badger".palindrome?
|
33
|
+
=> false
|
34
|
+
>> "deified".palindrome?
|
35
|
+
=> true
|
36
|
+
>> "Able was I, ere I saw Elba.".palindrome?
|
37
|
+
=> true
|
38
|
+
>> phrase = "Madam, I'm Adam."
|
39
|
+
>> phrase.palindrome?
|
40
|
+
=> true
|
41
|
+
```
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
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,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "eclectic_palindrome"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative 'lib/eclectic_palindrome/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'eclectic_palindrome'
|
5
|
+
spec.version = EclecticPalindrome::VERSION
|
6
|
+
spec.authors = ['eclectic-coding']
|
7
|
+
spec.email = ['chuck@eclecticsaddlebag.com']
|
8
|
+
|
9
|
+
spec.summary = 'Palindrome detector'
|
10
|
+
spec.description = 'Learn Enough Ruby palindrome detector'
|
11
|
+
spec.homepage = 'https://rubygems.org/eclectic/ruby_eclectic_palindrome'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
14
|
+
|
15
|
+
# spec.metadata['allowed_push_host'] = 'http://rubygems.org'
|
16
|
+
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/eclectic-coding/ruby_eclectic_palindrome'
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/eclectic-coding/ruby_eclectic_palindrome'
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = 'exe'
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ['lib']
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "eclectic_palindrome/version"
|
2
|
+
|
3
|
+
class String
|
4
|
+
|
5
|
+
# Return true for a palindrome, false otherwise
|
6
|
+
def palindrome?
|
7
|
+
processed_content == processed_content.reverse
|
8
|
+
end
|
9
|
+
|
10
|
+
def letters
|
11
|
+
chars.select { |c| c.match(/[a-z]/i) }.join
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
# Returns content for palidrome testing.
|
17
|
+
def processed_content
|
18
|
+
scan(/[a-z]/i).join.downcase
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eclectic_palindrome
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- eclectic-coding
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Learn Enough Ruby palindrome detector
|
14
|
+
email:
|
15
|
+
- chuck@eclecticsaddlebag.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- ".travis.yml"
|
22
|
+
- CODE_OF_CONDUCT.md
|
23
|
+
- Gemfile
|
24
|
+
- Gemfile.lock
|
25
|
+
- LICENSE.txt
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- bin/console
|
29
|
+
- bin/setup
|
30
|
+
- eclectic_palindrome.gemspec
|
31
|
+
- lib/eclectic_palindrome.rb
|
32
|
+
- lib/eclectic_palindrome/version.rb
|
33
|
+
homepage: https://rubygems.org/eclectic/ruby_eclectic_palindrome
|
34
|
+
licenses:
|
35
|
+
- MIT
|
36
|
+
metadata:
|
37
|
+
homepage_uri: https://rubygems.org/eclectic/ruby_eclectic_palindrome
|
38
|
+
source_code_uri: https://github.com/eclectic-coding/ruby_eclectic_palindrome
|
39
|
+
changelog_uri: https://github.com/eclectic-coding/ruby_eclectic_palindrome
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 2.3.0
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubygems_version: 3.1.2
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: Palindrome detector
|
59
|
+
test_files: []
|