class String

Public Instance Methods

letters() click to toggle source
# File lib/andrewau_palindrome.rb, line 11
def letters
  self.gsub(/\W+/, '')
end
palindrome?() click to toggle source

Returns true for a palindrome, false otherwise.

# File lib/andrewau_palindrome.rb, line 7
def palindrome?
  processed_content == processed_content.reverse
end

Private Instance Methods

processed_content() click to toggle source

Returns content for palindrome testing.

# File lib/andrewau_palindrome.rb, line 18
def processed_content
  self.letters.downcase
end