Sha256: ad1eac5eaabf3b9b19c3adf0bd840497fdf9fb28df595d456b825a7c72e56e03

Contents?: true

Size: 302 Bytes

Versions: 1

Compression:

Stored size: 302 Bytes

Contents

require "palindrome_detector/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
palindrome_detector-0.1.0 lib/palindrome_detector.rb