Sha256: 278b9a696e090b0a3de85575d8d95932a581acc5808dddec99854b389d46bdb7

Contents?: true

Size: 339 Bytes

Versions: 1

Compression:

Stored size: 339 Bytes

Contents

# frozen_string_literal: true

require_relative "slob_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
slob_palindrome-0.1.0 lib/slob_palindrome.rb