Sha256: 7ebd0935c64f2ecae194c43062b80ae002a2d0e05e2e4b6b9f0f097b394b0db2

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

require "sjwvuie_palindrome/version"

module SjwvuiePalindrome
  # Returns true for a palindrome, false otherwise
  def palindrome?
    if processed_content.empty?
      false
    else
      processed_content == processed_content.reverse
    end
  end

  private

    # Returns content for palindrome testing.
    def processed_content
      to_s.scan(/[a-z\d+]/i).join.downcase
    end
end

class String
  include SjwvuiePalindrome
end

class Integer
  include SjwvuiePalindrome
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sjwvuie_palindrome-0.2.0 lib/sjwvuie_palindrome.rb