Class: Translatomatic::Translation

Inherits:
Object
  • Object
show all
Defined in:
lib/translatomatic/translation.rb

Overview

Data object describing a text translation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original, result, translator = nil, from_database = false) ⇒ Translation

Returns a new instance of Translation.



16
17
18
19
20
21
# File 'lib/translatomatic/translation.rb', line 16

def initialize(original, result, translator = nil, from_database = false)
  @original = original
  @result = result
  @translator = translator
  @from_database = from_database
end

Instance Attribute Details

#from_databaseboolean (readonly)

Returns True if this translation came from the database.

Returns:

  • (boolean)

    True if this translation came from the database



14
15
16
# File 'lib/translatomatic/translation.rb', line 14

def from_database
  @from_database
end

#originalTranslatomatic::String (readonly)

Returns original string.

Returns:



5
6
7
# File 'lib/translatomatic/translation.rb', line 5

def original
  @original
end

#resultTranslatomatic::String

Returns translated string.

Returns:



8
9
10
# File 'lib/translatomatic/translation.rb', line 8

def result
  @result
end

#translatorSymbol (readonly)

Returns The name of the translator.

Returns:

  • (Symbol)

    The name of the translator



11
12
13
# File 'lib/translatomatic/translation.rb', line 11

def translator
  @translator
end