class BabelI18n::Translate
Attributes
key[RW]
text[RW]
Public Class Methods
new(text)
click to toggle source
# File lib/babel_i18n/translate.rb, line 10 def initialize(text) @text = text @from, @to = nil, nil end
Public Instance Methods
from(from)
click to toggle source
# File lib/babel_i18n/translate.rb, line 15 def from(from) @from = from end
source()
click to toggle source
# File lib/babel_i18n/translate.rb, line 27 def source @from end
target()
click to toggle source
# File lib/babel_i18n/translate.rb, line 23 def target @to end
to(to)
click to toggle source
# File lib/babel_i18n/translate.rb, line 19 def to(to) @to = to end
translate()
click to toggle source
# File lib/babel_i18n/translate.rb, line 31 def translate valid? ? google_translate : 'Error when translating' end
valid?()
click to toggle source
# File lib/babel_i18n/translate.rb, line 35 def valid? (!@text.nil? && !@text.empty?) && !@to.nil? end