Sha256: 2bc533b32e887ec3fe48586cc55e9f5597f82027083f484e6a6b0ee1e1c351d8

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

require "mpressen_palindrome/version"

module MpressenPalindrome
  class Error < StandardError; end

  # Returns true for a palindrome, false otherwise.
  def palindrome?
    processed_content == processed_content.reverse
  end

  private

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

end

class String
  include MpressenPalindrome
end

class Integer
  include MpressenPalindrome
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mpressen_palindrome-0.1.0 lib/mpressen_palindrome.rb