Module: Palindrome

Included in:
Integer, String
Defined in:
lib/dawidl022_palindrome.rb

Instance Method Summary collapse

Instance Method Details

#lettersObject



11
12
13
# File 'lib/dawidl022_palindrome.rb', line 11

def letters
  to_s.gsub(/[^\p{L}0-9]/, '')
end

#palindrome?Boolean

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/dawidl022_palindrome.rb', line 6

def palindrome?
  processed_content == processed_content.reverse \
  && processed_content.length >= 1
end