Module: Vocabulary

Defined in:
lib/vocabulary.rb,
lib/vocabulary/version.rb

Defined Under Namespace

Classes: Dictionary, LookUpError, Word

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.lookup(word, source_lang, target_lang = nil) ⇒ Object

Raises:

  • (ArgumentError)


62
63
64
65
66
67
68
# File 'lib/vocabulary.rb', line 62

def self.lookup(word, source_lang, target_lang = nil)
  target_lang ||= :en
  raise ArgumentError, "Word can't be blank" unless word.present?
  data = Vocabulary::Dictionary.new.get(word, source_lang.to_s, target_lang.to_s)
  # return data
  Vocabulary::Word.new(data, source_lang)
end