Class: GoogleWebTranslate::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/google_web_translate/cli.rb

Overview

Command line interface

Instance Method Summary collapse

Instance Method Details

#translate(string, from, to) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/google_web_translate/cli.rb', line 9

def translate(string, from, to)
  api_options = { debug: ENV['DEBUG'] }
  api_options[:dt] = options[:dt] if options[:dt]

  api = API.new(api_options)
  result = api.translate(string, from, to)
  pp result.to_h
end