lib/kpietrzk_palindrome.rb in kpietrzk_palindrome-0.2.0 vs lib/kpietrzk_palindrome.rb in kpietrzk_palindrome-0.2.1
- old
+ new
@@ -1,12 +1,17 @@
# frozen_string_literal: true
require 'kpietrzk_palindrome/version'
module KpietrzkPalindrome
+
# Returns true for a palindrome, false otherwise.
def palindrome?
- processed_content == processed_content.reverse
+ if processed_content.empty? || processed_content.match?(/^\s*$/)
+ false
+ else
+ processed_content == processed_content.reverse
+ end
end
private
# Returns content for palindrome testing.
\ No newline at end of file