mrobion_palindrome 0.2.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/README.md +27 -0
- data/Rakefile +12 -0
- data/lib/mrobion_palindrome/version.rb +5 -0
- data/lib/mrobion_palindrome.rb +26 -0
- data/sig/mrobion_palindrome.rbs +4 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: acb3d905bf099696660ef2ae2a63b0f22db08af3873fef243c9238a045c4e9a9
|
4
|
+
data.tar.gz: 7b9d972f2a1706bbd7ec14fad376b39fed7a7d104f19574524ebfc60cbd7107e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fa3d04193b32c141d2ebe812f8bccd9c0ff0f850053c11a08f172b7fcb7e16043887edb28ff622757f3c40d572954a936626621565f456f6be72bb242fb29571
|
7
|
+
data.tar.gz: 650db18522b9f302eaa6fe3ce240aa11c72894ad1ffd6f2428f770020f10a45b320109c48068356ca2c8753b6c62dc80cfa9d5ca6b5e9298b3e24802eac28887
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# MrobionPalindrome
|
2
|
+
|
3
|
+
This is a gem coming from the tutorial Learn Enough Ruby to Be Dangerous by Michael Hartl.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ bundle add 'mrobion_palindrome'
|
10
|
+
|
11
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
|
+
|
13
|
+
$ gem install 'mrobion_palindrome'
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Call it, to know if a string or an integer is a palindrome, meaning it reads the same from start to finish and finish to start.
|
18
|
+
|
19
|
+
## Development
|
20
|
+
|
21
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
22
|
+
|
23
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/MaximeRobion/mrobion_palindrome.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative "mrobion_palindrome/version"
|
2
|
+
|
3
|
+
module MrobionPalindrome
|
4
|
+
|
5
|
+
def palindrome?
|
6
|
+
processed_content == processed_content.reverse
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def processed_content
|
12
|
+
# 1. scan:
|
13
|
+
# 1. scan the string
|
14
|
+
# 2. make it an array of only the characters we want
|
15
|
+
# 2. join: bring back the array into a string
|
16
|
+
self.to_s.scan(/[a-z\d]/i).join.downcase
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class String
|
21
|
+
include MrobionPalindrome
|
22
|
+
end
|
23
|
+
|
24
|
+
class Integer
|
25
|
+
include MrobionPalindrome
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mrobion_palindrome
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Maxime Robion
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-06-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Lean Enough Ruby palindrome detector
|
14
|
+
email:
|
15
|
+
- max.robion@hey.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- README.md
|
21
|
+
- Rakefile
|
22
|
+
- lib/mrobion_palindrome.rb
|
23
|
+
- lib/mrobion_palindrome/version.rb
|
24
|
+
- sig/mrobion_palindrome.rbs
|
25
|
+
homepage: https://github.com/MaximeRobion/mrobion_palindrome
|
26
|
+
licenses: []
|
27
|
+
metadata:
|
28
|
+
allowed_push_host: https://rubygems.org
|
29
|
+
homepage_uri: https://github.com/MaximeRobion/mrobion_palindrome
|
30
|
+
source_code_uri: https://github.com/MaximeRobion/mrobion_palindrome
|
31
|
+
changelog_uri: https://github.com/MaximeRobion/mrobion_palindrome
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.6.0
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
requirements: []
|
47
|
+
rubygems_version: 3.4.14
|
48
|
+
signing_key:
|
49
|
+
specification_version: 4
|
50
|
+
summary: Palindrome detector
|
51
|
+
test_files: []
|