Sha256: bf87e96e0b7c0d1fc5746cc7aa5fde9b5b6e0933fb8809cdcb63e63db0d47584

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

# frozen_string_literal: true

#
# Overload the Integer class
#
class Integer
    def is_palindromic?
        return false if processed_content.empty?

        processed_content == processed_content.reverse
    end

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

#
# Overload the String class
#
class String
    def is_palindromic?
        return false if processed_content.empty?

        processed_content == processed_content.reverse
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
is_palindromic-1.0.2 lib/is_palindromic/overloads.rb