Module: Andyh82Palindrome

Included in:
Integer, String
Defined in:
lib/andyh82_palindrome.rb,
lib/andyh82_palindrome/version.rb

Constant Summary collapse

VERSION =
"0.3.0"

Instance Method Summary collapse

Instance Method Details

#palindrome?Boolean

Returns true for a palindrome, false otherwise.

Returns:

  • (Boolean)


7
8
9
10
11
12
13
# File 'lib/andyh82_palindrome.rb', line 7

def palindrome?
  if processed_content.empty? || !processed_content.match?(/\S/)
    return false
  else
    processed_content == processed_content.reverse
  end
end