Class: Translatomatic::ConverterStats
- Inherits:
-
Object
- Object
- Translatomatic::ConverterStats
- Defined in:
- lib/translatomatic/converter_stats.rb
Overview
Translation statistics
Instance Attribute Summary collapse
-
#from_db ⇒ Number
readonly
The number of translations that came from the database.
-
#from_translator ⇒ Number
readonly
The number of translations that came from the translator.
-
#translations ⇒ Number
readonly
The total number of strings translated.
Instance Method Summary collapse
- #+(other) ⇒ Object
-
#initialize(from_db, from_translator) ⇒ ConverterStats
constructor
A new instance of ConverterStats.
- #to_s ⇒ Object
Constructor Details
#initialize(from_db, from_translator) ⇒ ConverterStats
Returns a new instance of ConverterStats.
13 14 15 16 17 |
# File 'lib/translatomatic/converter_stats.rb', line 13 def initialize(from_db, from_translator) @translations = from_db + from_translator @from_db = from_db @from_translator = from_translator end |
Instance Attribute Details
#from_db ⇒ Number (readonly)
Returns The number of translations that came from the database.
8 9 10 |
# File 'lib/translatomatic/converter_stats.rb', line 8 def from_db @from_db end |
#from_translator ⇒ Number (readonly)
Returns The number of translations that came from the translator.
11 12 13 |
# File 'lib/translatomatic/converter_stats.rb', line 11 def from_translator @from_translator end |
#translations ⇒ Number (readonly)
Returns The total number of strings translated.
5 6 7 |
# File 'lib/translatomatic/converter_stats.rb', line 5 def translations @translations end |
Instance Method Details
#+(other) ⇒ Object
19 20 21 |
# File 'lib/translatomatic/converter_stats.rb', line 19 def +(other) self.class.new(@from_db + other.from_db, @from_translator + other.from_translator) end |
#to_s ⇒ Object
23 24 25 26 |
# File 'lib/translatomatic/converter_stats.rb', line 23 def to_s "Total translations: #{@translations} " + "(#{@from_db} from database, #{@from_translator} from translator)" end |