module Jfurn_Palindrome
Public Instance Methods
palindrome?()
click to toggle source
Returns true for a palindrome, false otherwise.
# File lib/jfurn_palindrome.rb, line 6 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/jfurn_palindrome.rb, line 17 def processed_content letter_regex = /([a-z]|\d)/i self.to_s.scan(letter_regex).join.downcase end