Sha256: 73b09d14540bb909e2cdcc6ebdd4d2cddaa348640783abcbd2654d48b4399dca

Contents?: true

Size: 510 Bytes

Versions: 1

Compression:

Stored size: 510 Bytes

Contents

require "andrewpeebles_palindrome/version"

module AndrewpeeblesPalindrome

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

  private

    # Returns content for palindrome testing.
    def processed_content
      self.to_s.scan(/\w/i).join.downcase
    end


class String
  include AndrewpeeblesPalindrome
end

class Integer
  include AndrewpeeblesPalindrome
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
andrewpeebles_palindrome-0.1.2 lib/andrewpeebles_palindrome.rb