class MemoryDictionary::Dictionary

Public Instance Methods

append_word(name, translation) click to toggle source
# File lib/memory_dictionary/dictionary.rb, line 19
def append_word(name, translation)
  words << MemoryDictionary::Word.new(name: name, translation: translation)
end
translations() click to toggle source

index 'words.name' => 1

# File lib/memory_dictionary/dictionary.rb, line 11
def translations
  words.map(&:translation).uniq
end
words_by_translation(translation) click to toggle source
# File lib/memory_dictionary/dictionary.rb, line 15
def words_by_translation(translation)
  words.where(translation: translation)
end