Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/is_palindromic/overloads.rb

Overview

Overload the String class

Instance Method Summary collapse

Instance Method Details

#is_palindromic?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/is_palindromic/overloads.rb', line 20

def is_palindromic?
    return false if processed_content.empty?

    processed_content == processed_content.reverse
end

#processed_contentObject



26
27
28
# File 'lib/is_palindromic/overloads.rb', line 26

def processed_content
    scan(/[[:alnum:]]/i).join.downcase
end