Sha256: 3c4ee26c250d8532c1347dee8a330612ac1cd585c1fcdd7344b4fabad3596a48
Contents?: true
Size: 534 Bytes
Versions: 2
Compression:
Stored size: 534 Bytes
Contents
require "romenigld_palindrome/version" module RomenigldPalindrome # 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 self.to_s.scan(/[a-z\d+]/i).join.downcase # or can use the Regex /[a-z0-9]/i end end class String include RomenigldPalindrome end class Integer include RomenigldPalindrome end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
romenigld_palindrome-1.0.0 | lib/romenigld_palindrome.rb |
romenigld_palindrome-0.2.0 | lib/romenigld_palindrome.rb |