Sha256: 0d7ac2dd1f718c1463ad443c3a8ceaaa03bdebfcdeddee066c59641dbe56b7e8
Contents?: true
Size: 529 Bytes
Versions: 5
Compression:
Stored size: 529 Bytes
Contents
class WordScramble::Descrambler def initialize(scrambled_word) @scrambled_word = WordScramble::ScrambledWord.new(scrambled_word) @matching_words = [] end def matching_words unless @already_descrambled descramble end @matching_words end def descramble WordScramble::DICTIONARY.each do |word| if @scrambled_word.can_make?(word) @matching_words.push(word) end end @matching_words.sort! { |a,b| b.length <=> a.length } @already_descrambled = true end end
Version data entries
5 entries across 5 versions & 1 rubygems