lib/cellane_palindrome.rb in cellane_palindrome-0.1.0 vs lib/cellane_palindrome.rb in cellane_palindrome-1.0.0
- old
+ new
@@ -1,13 +1,25 @@
require 'cellane_palindrome/version'
-class String
+module Palindrome
def palindrome?
- processed_content == processed_content.reverse
+ if processed_content.empty?
+ false
+ else
+ processed_content == processed_content.reverse
+ end
end
private
def processed_content
- scan(/[a-z]/i).join.downcase
+ to_s.scan(/[a-z0-9]/i).join.downcase
end
+end
+
+class String
+ include Palindrome
+end
+
+class Integer
+ include Palindrome
end