Module: YoudaoFanyi

Defined in:
lib/youdao_fanyi/configuration.rb,
lib/youdao_fanyi.rb,
lib/youdao_fanyi/errors.rb,
lib/youdao_fanyi/version.rb,
lib/youdao_fanyi/connector.rb,
lib/youdao_fanyi/translator.rb

Overview

YoudaoFanyi::Configuration.http_proxy = ‘127.0.0.1:8118

Defined Under Namespace

Modules: Errors Classes: Connector, InstallGenerator, Translator

Constant Summary collapse

VERSION =
"0.1.2.2"
Configuration =
Struct.new(
  :api_keys,
  :http_proxy
).new(
  [{ "keyfrom" => "test.vkill.net", "key" => "1234567890" }],
  nil
)

Class Method Summary collapse

Class Method Details

.api_keyObject



29
30
31
# File 'lib/youdao_fanyi.rb', line 29

def self.api_key
  YoudaoFanyi::Configuration.api_keys.sort_by!{rand()}.first
end

.configure {|Configuration| ... } ⇒ Object

Yields:



19
20
21
22
# File 'lib/youdao_fanyi.rb', line 19

def self.configure
  yield Configuration
  reload!
end

.reload!Object



24
25
26
27
# File 'lib/youdao_fanyi.rb', line 24

def self.reload!
  load "youdao_fanyi/connector.rb"
  load "youdao_fanyi/translator.rb"
end

.t(*words) ⇒ Object



33
34
35
# File 'lib/youdao_fanyi.rb', line 33

def self.t(*words)
  YoudaoFanyi::Translator.t(*words)
end