Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/drjprogramming_palindrome.rb

Instance Method Summary collapse

Instance Method Details

#lettersObject

Returns the letters in the string.



13
14
15
# File 'lib/drjprogramming_palindrome.rb', line 13

def letters
  self.chars.select { |c| c.match(/[a-z]/i) }.join
end

#palindrome?Boolean

Returns true for a palindrome, false otherwise.

Returns:

  • (Boolean)


8
9
10
# File 'lib/drjprogramming_palindrome.rb', line 8

def palindrome?
  processed_content == processed_content.reverse
end