Sha256: f82642db74ff1d4e51d38a4307bb503df3bc68a733f374066f80741468bf7781

Contents?: true

Size: 306 Bytes

Versions: 1

Compression:

Stored size: 306 Bytes

Contents

require "juandpineiro_palindrome/version"

class String
  # Returns true for a palindrome, false otherwise.
  def palindrome?
    processed_content == processed_content.reverse
  end

  private

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
juandpineiro_palindrome-0.1.0 lib/juandpineiro_palindrome.rb