bottles_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/Gemfile +11 -0
- data/Gemfile.lock +30 -0
- data/README.md +51 -0
- data/Rakefile +12 -0
- data/lib/bottles_palindrome/version.rb +5 -0
- data/lib/bottles_palindrome.rb +35 -0
- data/sig/bottles_palindrome.rbs +4 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c4319e6b5dd1d1641fa4a543993f2c1774090666df0bf495a8e7bd77a8e759ab
|
4
|
+
data.tar.gz: 17f6ad2f809d1f002209bca1f60f818b32be1e1a3fe277e8e971e4b91d62b1f7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 54653064c45fec3914245cf8a3fd5ed562a15652b0656f3d0e3406f78a366a6341cf2931671fc0e3f8b970fc0fa1b3ecc82fc5eab500b571b9f8e4d31ea8d69c
|
7
|
+
data.tar.gz: bf3bdd03a9ec7fbd3dd5877a50fbed723c7d572039a084bda781e4ad200c5eeba73984645a29760b2a715c6805ff1a4512e7c9540bfb6b79443d37112cafe31b
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bottles_palindrome (0.2.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ansi (1.5.0)
|
10
|
+
builder (3.2.4)
|
11
|
+
minitest (5.17.0)
|
12
|
+
minitest-reporters (1.6.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
|
+
x86_64-linux
|
22
|
+
|
23
|
+
DEPENDENCIES
|
24
|
+
bottles_palindrome!
|
25
|
+
minitest (~> 5.0)
|
26
|
+
minitest-reporters (~> 1.6)
|
27
|
+
rake (~> 13.0)
|
28
|
+
|
29
|
+
BUNDLED WITH
|
30
|
+
2.4.7
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# BottlesPalindrome
|
2
|
+
|
3
|
+
`bottles_palindrome` is a sample ruby gem
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
To install `bottles_palindrome`, add this line to your application's `Gemfile`:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'bottles_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 bottles_palindrome
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
`bottles_palindrome` adds a `palindrome?` method to the `String` class, and can be used as follows:
|
28
|
+
|
29
|
+
```
|
30
|
+
$ irb
|
31
|
+
>> require 'bottles_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
|
+
## Development
|
44
|
+
|
45
|
+
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.
|
46
|
+
|
47
|
+
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).
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[bottles10]/bottles_palindrome.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "bottles_palindrome/version"
|
4
|
+
|
5
|
+
module BottlesPalindrome
|
6
|
+
|
7
|
+
#returns True for a palindrome, False otherwise
|
8
|
+
def palindrome?
|
9
|
+
if processed_content.empty?
|
10
|
+
false
|
11
|
+
else
|
12
|
+
processed_content == processed_content.reverse
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
#processes string content for palindrome
|
19
|
+
def processed_content
|
20
|
+
to_s.scan(/[a-zA-Z]/i).join.downcase
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class String
|
25
|
+
include BottlesPalindrome
|
26
|
+
end
|
27
|
+
|
28
|
+
class Integer
|
29
|
+
include BottlesPalindrome
|
30
|
+
|
31
|
+
def processed_content
|
32
|
+
to_s.downcase
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bottles_palindrome
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- bottles10
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Ruby palindrome detector with sinatra DSL framework
|
14
|
+
email:
|
15
|
+
- henryaovare@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- Gemfile
|
21
|
+
- Gemfile.lock
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- lib/bottles_palindrome.rb
|
25
|
+
- lib/bottles_palindrome/version.rb
|
26
|
+
- sig/bottles_palindrome.rbs
|
27
|
+
homepage: https://github.com/bottles10/palindrome
|
28
|
+
licenses: []
|
29
|
+
metadata:
|
30
|
+
allowed_push_host: https://rubygems.org
|
31
|
+
homepage_uri: https://github.com/bottles10/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.7
|
48
|
+
signing_key:
|
49
|
+
specification_version: 4
|
50
|
+
summary: palindrome detector
|
51
|
+
test_files: []
|