class Palindrome
Public Class Methods
check_palindrome(str)
click to toggle source
# File lib/string_palindrome.rb, line 3 def self.check_palindrome(str) str_arr = str.split('') (0..(str.length/2)).each do |index| if !(str_arr[index].eql?(str_arr[str.length - index - 1])) return false end end return true end