Class: Sogou::Translate::CLI
- Inherits:
-
Thor
- Object
- Thor
- Sogou::Translate::CLI
- Defined in:
- lib/sogou/translate/cli.rb
Instance Method Summary collapse
Instance Method Details
#translate(text = '文章本天成,妙手偶得之') ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/sogou/translate/cli.rb', line 20 def translate(text='文章本天成,妙手偶得之') js = Sogou::Translate.translate(text) puts " #{green("From")}: #{js['translate']['from']}" puts " #{green("To")}: #{js['translate']['to']}" puts " #{green("Text")}: #{js['translate']['text']}" puts "#{green("Result")}: #{js['translate']['dit']}" end |