Module: AnkiTranslator::References

Defined in:
lib/vocab_to_anki/references.rb,
lib/vocab_to_anki/references/merriam_webster.rb,
lib/vocab_to_anki/references/google_translate.rb,
lib/vocab_to_anki/references/macmillan_dictionary.rb

Defined Under Namespace

Classes: Definition, GoogleTranslate, MacmillanDictionary, MerriamWebster, Translation

Class Method Summary collapse

Class Method Details

.definitions_and_translations(term) ⇒ Object



9
10
11
12
13
14
# File 'lib/vocab_to_anki/references.rb', line 9

def definitions_and_translations(term)
  definitions = sources.map { |s| s.fetch_definitions(term) }.flatten.compact
  definitions.each_with_object([[], []]) do |d, arr|
    d.is_a?(Definition) ? arr[0] << d : arr[1] << d
  end
end

.source_namesObject



16
17
18
# File 'lib/vocab_to_anki/references.rb', line 16

def source_names
  sources.map(&:name)
end