lib/eveveneno_palindrome.rb in eveveneno_palindrome-0.1.0 vs lib/eveveneno_palindrome.rb in eveveneno_palindrome-0.2.0
- old
+ new
@@ -1,16 +1,23 @@
require_relative "eveveneno_palindrome/version"
-class String
+module EvevenenoPalindrome
+ # Returns true for a palindrome, false otherwise. def palindrome?
+ def palindrome?
+ processed_content == processed_content.reverse
+ end
- # Returns true for a palindrome, false otherwise. def palindrome?
- def palindrome?
- processed_content == processed_content.reverse
- end
+ private
- private
+ # Returns content for palindrome testing.
+ def processed_content
+ self.to_s.scan(/[a-z\d]/i).join.downcase
+ end
+end
- # Returns content for palindrome testing.
- def processed_content
- self.scan(/[a-z]/i).join.downcase
- end
+class String
+ include EvevenenoPalindrome
+end
+
+class Integer
+ include EvevenenoPalindrome
end
\ No newline at end of file