Sha256: 97ed57eed876a84579df2757d1957dcf19f74b22a6dca2f84ee74506ad279455

Contents?: true

Size: 460 Bytes

Versions: 1

Compression:

Stored size: 460 Bytes

Contents

require "tcarter_palindrome/version"

module TcarterPalindrome

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

	private

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

class String
	include TcarterPalindrome
end

class Integer
	include TcarterPalindrome
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tcarter_palindrome-1.0.0 lib/tcarter_palindrome.rb