module ToddPalindrome

Constants

VERSION

Public Instance Methods

letters_and_digits() click to toggle source

Returns the letters and digits in the string.

# File lib/todd_palindrome.rb, line 15
def letters_and_digits
  self.to_s.scan(/\w/).join
end
palindrome?() click to toggle source

Returns true for a palindrome, false otherwise.

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

Private Instance Methods

processed_content() click to toggle source

Returns content for palindrome testing.

# File lib/todd_palindrome.rb, line 22
def processed_content
  letters_and_digits.downcase
end