Sha256: bf4eca5ec2e8abf377c5ce8b35c3fb946fbfe6799116a385f7032fa164de4c06

Contents?: true

Size: 406 Bytes

Versions: 1

Compression:

Stored size: 406 Bytes

Contents

require 'kmff_palindrome/version'

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

class Integer
  include KmffPalindrome
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kmff_palindrome-0.2.0 lib/kmff_palindrome.rb