class String

Public Instance Methods

letters() click to toggle source
# File lib/eclectic_palindrome.rb, line 10
def letters
  chars.select { |c| c.match(/[a-z]/i) }.join
end
palindrome?() click to toggle source

Return true for a palindrome, false otherwise

# File lib/eclectic_palindrome.rb, line 6
def palindrome?
  processed_content == processed_content.reverse
end

Private Instance Methods

processed_content() click to toggle source

Returns content for palidrome testing.

# File lib/eclectic_palindrome.rb, line 17
def processed_content
  scan(/[a-z]/i).join.downcase
end