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