Sha256: 518dca66be28a8570406cf5c5a5dbad0549fbb0b3e9a09414adec19ef7ebb9fc

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

require_relative "sekidome_palin/version"

class String
  #returns true if palindrome, else false
  def palin? 
    processed == processed.reverse # here processed will use the returned value from the method processed
  end 

    # returns content for palin testing
  def processed
    self.downcase.gsub(/\W/, '')
  end 
end

class Integer
  #returns true if palindrome, else false
  def palin? 
    processed == processed.reverse # here processed will use the returned value from the method processed
  end 

    # returns content for palin testing
  def processed
    self.to_s
  end 
end

# module SekidomePalin
#   class Error < StandardError; end
#   # Your code goes here...
# end

# "A man, a plan, a canal".downcase.gsub(/[^a-zA-Z]/, '')

p "1221".palin?

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sekidome_palin-0.1.1 lib/sekidome_palin.rb