module PsmithPalindrome
Constants
- VERSION
Public Instance Methods
palindrome?()
click to toggle source
Returns true for a palindrome, false otherwise.
# File lib/psmith_palindrome.rb, line 8 def palindrome?() processed_content = self.processed_content return false if processed_content.empty? processed_content == processed_content.reverse end
Private Instance Methods
processed_content()
click to toggle source
Returns content for palindrome testing
# File lib/psmith_palindrome.rb, line 17 def processed_content to_s.scan(/[a-z]*\d*/i).join.downcase end