Sha256: 690955f400bf06ad0cd154cd910afa1752e35e5c38777d6ec537caf48821eba1
Contents?: true
Size: 550 Bytes
Versions: 2
Compression:
Stored size: 550 Bytes
Contents
require "juandpineiro_palindrome/version" module JuandpineiroPalindrome # Returns true for a palindrome, false otherwise. def palindrome? if processed_content.empty? false else processed_content == processed_content.reverse end end private # Returns content for palindrome testing. def processed_content # Ignores anything that is not a letter or number to_s.scan(/[a-z\d]/i).join.downcase end end class String include JuandpineiroPalindrome end class Integer include JuandpineiroPalindrome end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
juandpineiro_palindrome-0.2.2 | lib/juandpineiro_palindrome.rb |
juandpineiro_palindrome-0.2.1 | lib/juandpineiro_palindrome.rb |