lib/sekidome_palin.rb in sekidome_palin-0.1.0 vs lib/sekidome_palin.rb in sekidome_palin-0.1.1
- old
+ new
@@ -12,11 +12,25 @@
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]/, '')
+# "A man, a plan, a canal".downcase.gsub(/[^a-zA-Z]/, '')
+
+p "1221".palin?
\ No newline at end of file