require "snajam_palindrome/version" #module SnajamPalindrome class String # Returns true for a palindrome, false otherwise. def palindrome? processed_content == processed_content.reverse end # Returns the letters in the string. # def letters #self.chars.select { |c| c.match(/[a-z]/i) }.join #end private # Returns content for palindrome testing. def processed_content self.scan(/[a-z]/i).join.downcase #self.letters.downcase end end # Returns the letters in the string. #def letters #the_letters = [] #letter_regex = /[a-z]/i #self.chars.each do |character| # if character.match(letter_regex) # the_letters << character # end #end #the_letters.join #end