Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/drjprogramming_palindrome.rb
Instance Method Summary collapse
-
#letters ⇒ Object
Returns the letters in the string.
-
#palindrome? ⇒ Boolean
Returns true for a palindrome, false otherwise.
Instance Method Details
#letters ⇒ Object
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.
8 9 10 |
# File 'lib/drjprogramming_palindrome.rb', line 8 def palindrome? processed_content == processed_content.reverse end |