lib/kyleharv_palindrome.rb in kyleharv_palindrome-0.1.0 vs lib/kyleharv_palindrome.rb in kyleharv_palindrome-0.2.0

- old
+ new

@@ -1,16 +1,28 @@ require "kyleharv_palindrome/version" -class String +module KyleharvPalindrome # Returns true for a palindrome, false otherwise. def palindrome? - processed_content == processed_content.reverse + if processed_content.empty? + false + else + processed_content == processed_content.reverse + end end private # Returns content for palindrome testing. def processed_content - self.scan(/[a-z]/i).join.downcase + self.to_s.scan(/[a-z0-9]/i).join.downcase end +end + +class String + include KyleharvPalindrome +end + +class Integer + include KyleharvPalindrome end