Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/palindrome/core_ext/string/palindrome.rb
Instance Method Summary collapse
Instance Method Details
#palindrome? ⇒ Boolean
2 3 4 5 6 |
# File 'lib/palindrome/core_ext/string/palindrome.rb', line 2 def palindrome? return false if self.empty? test_string = self.downcase.gsub(/[^[:alnum:]]/, '') test_string == test_string.reverse end |