Module: PatrickPalindrome
- Defined in:
- lib/patrick_palindrome.rb,
lib/patrick_palindrome/version.rb
Constant Summary collapse
- VERSION =
"0.3.0"
Instance Method Summary collapse
-
#palindrome? ⇒ Boolean
Returns true for a palindrome, false otherwise.
Instance Method Details
#palindrome? ⇒ Boolean
Returns true for a palindrome, false otherwise.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/patrick_palindrome.rb', line 8 def palindrome? # Empty strings are not palindromes if processed_content.length == 0 return false end # Strings with only whitespace characters are not palindromes if processed_content.scan(/\S/).length == 0 return false end processed_content == processed_content.reverse end |