Sha256: 5497fb9f888536cf0086acd344a331dae4331e4b0ded6889a82598f372014913

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 Bytes

Contents

require "rbuendiaramos_palindrome/version"

module  RbuendiaramosPalindrome

  # Detect palindrome function
  def palindrome?
    if processed_content == "" || processed_content.match(/\s+/)
      return false
    else
      processed_content == processed_content.reverse
    end

  end

  private
  #  Downcase phrase for palindrome testing
  def processed_content
    self.to_s.scan(/[a-z\d]/i).join.downcase
  end

end

class String
  include RbuendiaramosPalindrome
end

class Integer
  include RbuendiaramosPalindrome
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbuendiaramos_palindrome-0.2.0 lib/rbuendiaramos_palindrome.rb