Sha256: 51e623323ead2cad0b65bd66a1a178d3d1e1c16f1ca7fd7d2ec88b3a73e5a062

Contents?: true

Size: 322 Bytes

Versions: 2

Compression:

Stored size: 322 Bytes

Contents

# frozen_string_literal: true

require_relative "test_palindrome_gem/version"

class String 

  def palindrome?
    processed_content == processed_content.reverse
  end

  # Return only the letters
  def letters
    self.scan(/[a-z]/i).join
  end

  private 
  
  def processed_content
    self.letters.downcase
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
test_palindrome_gem-0.1.1 lib/test_palindrome_gem.rb
test_palindrome_gem-0.1.0 lib/test_palindrome_gem.rb