ilyass_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 +11 -0
- data/README.md +55 -0
- data/Rakefile +8 -0
- data/lib/ilyass_palindrome/version.rb +5 -0
- data/lib/ilyass_palindrome.rb +21 -0
- data/sig/ilyass_palindrome.rbs +4 -0
- metadata +52 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5adff2442513252d13b958fa46d3ea3cf0cd1f437f8dc99f76d9534f5d2d471c
|
4
|
+
data.tar.gz: 0d03c2c50a7dec857529d95368a759a9162a2812da9c20071975f23adbabdc06
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fab9048d875f462ed27b52c4f4184236f7ef0ff2a736e668475381eff1f3d582592f0a37c1e08ffe6bc220df7093b8be40e25dff863c4f7c2fbc7f88b7217291
|
7
|
+
data.tar.gz: f791baf7b06706b82d549f1f5bfc3161536003a0986fbf9cb6155da460955c5c4cd4889ae327f8cd62a451b4463876ce877ed3e120def168b455dc8a7e8c1c77
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
- Added: Initial implementation of palindrome checking functionality.
|
10
|
+
|
11
|
+
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Palindrome detector
|
2
|
+
|
3
|
+
`ilyass_palindrome` is a sample Ruby gem created in Learn ENough Ruby to Be Dangerous by Michael Hartl.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
To install `ilyass_palindrome`, add this line to your application's `Gemfile`:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
11
|
+
```
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
gem `ilyass_palindrome`
|
17
|
+
```
|
18
|
+
Then install as follows:
|
19
|
+
|
20
|
+
```bash
|
21
|
+
$ bundle install
|
22
|
+
```
|
23
|
+
Or install directly using `gem`:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
gem install ilyass_palindrome
|
27
|
+
```
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
First add the module to the `String` and `Integer` classes, e.g:
|
31
|
+
```ruby
|
32
|
+
class String
|
33
|
+
include Palindrome
|
34
|
+
end
|
35
|
+
class Integer
|
36
|
+
include Palindrome
|
37
|
+
end
|
38
|
+
```
|
39
|
+
Now you can use the `palindrome?` method directly on string and integer literals, e.g:
|
40
|
+
```ruby
|
41
|
+
"Racecar".palindrome?
|
42
|
+
=> true
|
43
|
+
12321.palindrome?
|
44
|
+
=> true
|
45
|
+
```
|
46
|
+
|
47
|
+
## Development
|
48
|
+
|
49
|
+
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.
|
50
|
+
|
51
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ILyass-Lr/ilyass_palindrome.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ilyass_palindrome/version"
|
4
|
+
|
5
|
+
class String
|
6
|
+
# Returns true for a palinfrome, false otherwise.
|
7
|
+
def palindrome?
|
8
|
+
processed_content == processed_content.reverse
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
# Returns content for palindrome testing
|
14
|
+
def processed_content
|
15
|
+
self.scan(/[a-z]/i).join.downcase
|
16
|
+
end
|
17
|
+
end
|
18
|
+
# module IlyassPalindrome
|
19
|
+
# class Error < StandardError; end
|
20
|
+
# # Your code goes here...
|
21
|
+
# end
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ilyass_palindrome
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ILyass-Lr
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Learn Enough Ruby palindrome detector
|
14
|
+
email:
|
15
|
+
- lirmaqui.ilyass@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- CHANGELOG.md
|
21
|
+
- README.md
|
22
|
+
- Rakefile
|
23
|
+
- lib/ilyass_palindrome.rb
|
24
|
+
- lib/ilyass_palindrome/version.rb
|
25
|
+
- sig/ilyass_palindrome.rbs
|
26
|
+
homepage: https://github.com/ILyass-Lr/ilyass_palindrome
|
27
|
+
licenses: []
|
28
|
+
metadata:
|
29
|
+
allowed_push_host: https://rubygems.org/
|
30
|
+
homepage_uri: https://github.com/ILyass-Lr/ilyass_palindrome
|
31
|
+
source_code_uri: https://github.com/ILyass-Lr/ilyass_palindrome
|
32
|
+
changelog_uri: https://github.com/ILyass-Lr/ilyass_palindrome/blob/master/CHANGELOG.md
|
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.1.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.3.27
|
49
|
+
signing_key:
|
50
|
+
specification_version: 4
|
51
|
+
summary: Palindrome detector
|
52
|
+
test_files: []
|