Sha256: 751c98ece9a65ecd8153d1bccdd7320f69693e3325c8bd5f68847ffb6029afa5

Contents?: true

Size: 422 Bytes

Versions: 1

Compression:

Stored size: 422 Bytes

Contents

require "dhoard_palindrome/version"

module DhoardPalindrome

  # 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 DhoardPalindrome
end

class Integer
	include DhoardPalindrome
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dhoard_palindrome-0.2.0 lib/dhoard_palindrome.rb