0.0
No release in over a year
Overrides Ruby's default String, Integer, and Array classes to determine whether or not their contents can be considered a palindrome.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.2.0
~> 2.1
~> 13.0, >= 13.0.6
~> 3.10
~> 1.22, >= 1.22.3
~> 0.6.0
~> 0.9.26
 Project Readme

PalindromeExt

Ruby Gem Version Downloads Ruby Style Guide Platform

A gem focused on extending Ruby's String and Integer classes by adding a .palindrome? method, to solve a common algorithm problem of determining whether a string or integer may be a palindrome.

Installation

Add this line to your application's Gemfile:

gem 'palindrome_ext'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install palindrome_ext

Usage

Detailed documentation can be found at https://rubydoc.info/gems/palindrome_ext.

String

require 'palindrome_ext/string'

# Palindrome - Case Sensitive & Whitespace Sensitive
'Example...'.palindrome? # => false
'radar'.palindrome? # => true
'Radar'.palindrome? # => false

# Non-Strict Palindrome - Removes whitespace, punctuation, and capitalization before checking.
'Radar'.palindrome? false # => true
'RadaR'.palindrome? # => false

Integer

require 'palindrome_ext/integer'

# Palindrome - Check if the integer is a palindrome
112.palindrome? # => false
101.palindrome? # => true

# And works on operations
(91 * 99).palindrome? # => true

Development

Dependency Management

After forking this repo, navigate to the root directory and run:

$ bundle install

Testing with RSpec

To run tests, simply run:

$ rake test

Linting with RuboCop

To check if there are any style offenses in your forked repository and automatically fix these offenses, run:

$ rake lint

Benchmarking

To execute a benchmark report, run:

$ rake benchmark

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/aj-rom/palindrome_ext. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the PalindromeExt project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.