module GoatatworkPalindrome

Constants

VERSION

Public Instance Methods

letters() click to toggle source

Returns the letters in the string.

# File lib/goatatwork_palindrome.rb, line 10
def letters
  self.chars.select { |c| c.match(/[a-z]/i) }.join
end
palindrome?() click to toggle source

Returns true for a palindrome, false otherwise.

# File lib/goatatwork_palindrome.rb, line 5
def palindrome?
  processed_content == processed_content.reverse
end

Private Instance Methods

processed_content() click to toggle source

Returns content for palindrome testing.

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