class Palindromes::Base
Attributes
histograms[R]
palindromes[R]
Public Instance Methods
find(data)
click to toggle source
search for palindromes
# File lib/palindromes/base.rb, line 6 def find(data) @palindromes = data.select do |word| palindrome?(word) end histogram end
Private Instance Methods
histogram()
click to toggle source
get histogram
# File lib/palindromes/base.rb, line 21 def histogram @histograms = Hash.new(0) @palindromes.each { |word| @histograms[word] += 1 } end
palindrome?(word)
click to toggle source
to determine palindrome word must be eq to its reverse
# File lib/palindromes/base.rb, line 16 def palindrome?(word) word == word.reverse end