Sha256: 7d2848814f65b13e6975ca520d2fd98ab1d125a1add3e869c549d7f8faab1068

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

require "evanlsolomon_palindrome/version"

module EvanlsolomonPalindrome
  # 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 EvanlsolomonPalindrome
end

class Integer
  include EvanlsolomonPalindrome
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evanlsolomon_palindrome-0.2.0 lib/evanlsolomon_palindrome.rb