wils_palindrome 0.1.0
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 +7 -0
- data/CHANGELOG.md +5 -0
- data/README.md +45 -0
- data/Rakefile +8 -0
- data/lib/wils_palindrome/version.rb +5 -0
- data/lib/wils_palindrome.rb +15 -0
- data/sig/wils_palindrome.rbs +4 -0
- metadata +52 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 939e7d9e742e2fefcb24b5b34d647c211e0c5c54cdf99e134c22ca32599f7ef2
|
4
|
+
data.tar.gz: a3ca6e4c7d3a8ff2a132b828182c69bf0b616de8e1a251c44808006f3d2240a0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b57734e3b49f2f801d54f4e66008c0094023e56e3a59b0ff78f0de7a30f4c0d0256f47874fd579df6efd0e54bff2154d95ff0fe9d5afe4979314f6c4e5410c59
|
7
|
+
data.tar.gz: d7ab68d808858bd6b1771c8dfd729ce6ec0852e51c8d2c4e3bf7666b02d58c957ee93eb6041dd281604335b6a5690960fbe88ceba4f40b7965889a28dcab5346
|
data/CHANGELOG.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Palindrome detector
|
2
|
+
|
3
|
+
`wils_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 `wils_palindrome`, add this line to your application's `Gemfile`:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'wils_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 wils_palindrome
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
`wils_palindrome` adds a `palindrome?` method to the `String` class, and can be used as follows:
|
28
|
+
|
29
|
+
```
|
30
|
+
$ irb
|
31
|
+
>> require 'wils_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
@@ -0,0 +1,15 @@
|
|
1
|
+
require "wils_palindrome/version"
|
2
|
+
|
3
|
+
class String
|
4
|
+
|
5
|
+
#Returns true for a palindrome, false otherwise
|
6
|
+
def palindrome?
|
7
|
+
processed_content == processed_content.reverse
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
#Returns content for palindrome testing
|
12
|
+
def processed_content
|
13
|
+
self.scan(/[a-z]/i).join("").downcase
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wils_palindrome
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mkdirprince
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Learn Enough Ruby palindrome detector
|
14
|
+
email:
|
15
|
+
- mkdirprince@github.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- CHANGELOG.md
|
21
|
+
- README.md
|
22
|
+
- Rakefile
|
23
|
+
- lib/wils_palindrome.rb
|
24
|
+
- lib/wils_palindrome/version.rb
|
25
|
+
- sig/wils_palindrome.rbs
|
26
|
+
homepage: https://github.com/mkdirprince/wils_palindrome
|
27
|
+
licenses: []
|
28
|
+
metadata:
|
29
|
+
allowed_push_host: https://rubygems.org/
|
30
|
+
homepage_uri: https://github.com/mkdirprince/wils_palindrome
|
31
|
+
source_code_uri: https://github.com/mkdirprince/wils_palindrome
|
32
|
+
changelog_uri: https://github.com/mkdirprince/wils_palindrome
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 3.0.0
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubygems_version: 3.5.6
|
49
|
+
signing_key:
|
50
|
+
specification_version: 4
|
51
|
+
summary: Palindrome detector
|
52
|
+
test_files: []
|