Class: Google::Translator

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml_translate/translator.rb

Instance Method Summary collapse

Instance Method Details

#translate(from, to, from_text, options = {}) ⇒ Object

Calling the original method while gracefully return a string on any error despite an Interrupt



10
11
12
13
14
15
16
17
18
# File 'lib/yaml_translate/translator.rb', line 10

def translate from, to, from_text, options={}
  begin
    translate_original from, to, from_text, options
  rescue Interrupt
    exit 1
  rescue Exception => e
    ["[FAIL] #{from_text}", '']
  end
end

#translate_originalObject



7
# File 'lib/yaml_translate/translator.rb', line 7

alias_method :translate_original, :translate