module Palindrome
Public Instance Methods
palindrome?()
click to toggle source
Returns true for a palindrome, false otherwise.
# File lib/palindrome_detector.rb, line 5 def palindrome? if processed_content.empty? false else processed_content == processed_content.reverse end end
Private Instance Methods
processed_content()
click to toggle source
Returns content for palindrome testing.
# File lib/palindrome_detector.rb, line 16 def processed_content self.to_s.strip.scan(/[a-z0-9]/i).join.downcase end