# frozen_string_literal: true require 'kpietrzk_palindrome/version' module KpietrzkPalindrome # Returns true for a palindrome, false otherwise. def palindrome? if processed_content.empty? || processed_content.match?(/^\s*$/) false else processed_content == processed_content.reverse end end private # Returns content for palindrome testing. def processed_content to_s.scan(/[a-z\d]/i).join('').downcase end end class String include KpietrzkPalindrome end class Integer include KpietrzkPalindrome end