module JohnnyNumber5Palindrome

Constants

VERSION

Public Instance Methods

palindrome?() click to toggle source

Returns true if the text is a palindrome, false otherwise.

# File lib/JohnnyNumber5_palindrome.rb, line 7
def palindrome?
  if processed_content.empty?
    false
  else
    processed_content == processed_content.reverse
  end
end

Private Instance Methods

processed_content() click to toggle source

Converts the string's content to lower case.

# File lib/JohnnyNumber5_palindrome.rb, line 18
def processed_content
  to_s.scan(/[a-z0-9]/i).join.downcase
end