Class: Translatomatic::Translation::Stats

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

Overview

Translation statistics

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#from_dbNumber (readonly)

Returns The number of translations that came from the database.

Returns:

  • (Number)

    The number of translations that came from the database.



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

def from_db
  @from_db
end

#from_providerNumber (readonly)

Returns The number of translations that came from the provider.

Returns:

  • (Number)

    The number of translations that came from the provider.



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

def from_provider
  @from_provider
end

#translationsArray<Result> (readonly)

Returns A list of all translations.

Returns:

  • (Array<Result>)

    A list of all translations



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

def translations
  @translations
end

#untranslatedNumber (readonly)

Returns The number of untranslated strings.

Returns:

  • (Number)

    The number of untranslated strings



17
18
19
# File 'lib/translatomatic/translation/stats.rb', line 17

def untranslated
  @untranslated
end

Instance Method Details

#+(other) ⇒ Stats

Combine stats with another object

Parameters:

  • other (Stats)

    Another stats object

Returns:

  • (Stats)

    The result of adding this to other



22
23
24
25
# File 'lib/translatomatic/translation/stats.rb', line 22

def +(other)
  raise "expected Stats, got #{other.class}" unless other.is_a?(Stats)
  Stats.new(translations + other.translations)
end