module Ari97Palindrome

Constants

VERSION

Public Instance Methods

letters() click to toggle source
# File lib/ari97_palindrome.rb, line 16
def letters
  scan(/[a-z\d]/i).join("")
end
palindrome?() click to toggle source

Returns true for a palindrome, false otherwise

# File lib/ari97_palindrome.rb, line 8
def palindrome?
  unless processed_content.strip.empty?
    processed_content == processed_content.reverse
  else
    false
  end
end

Private Instance Methods

processed_content() click to toggle source

Returns content for palindrome testing

# File lib/ari97_palindrome.rb, line 23
def processed_content
  to_s.letters.downcase
end