Class: Translate::Log
- Inherits:
-
Object
- Object
- Translate::Log
- Defined in:
- lib/translate/log.rb
Instance Attribute Summary (collapse)
-
- (Object) from_locale
Returns the value of attribute from_locale.
-
- (Object) keys
Returns the value of attribute keys.
-
- (Object) to_locale
Returns the value of attribute to_locale.
Instance Method Summary (collapse)
-
- (Log) initialize(from_locale, to_locale, keys)
constructor
A new instance of Log.
- - (Object) read
- - (Object) write_to_file
Constructor Details
- (Log) initialize(from_locale, to_locale, keys)
A new instance of Log
7 8 9 10 11 |
# File 'lib/translate/log.rb', line 7 def initialize(from_locale, to_locale, keys) self.from_locale = from_locale self.to_locale = to_locale self.keys = keys end |
Instance Attribute Details
- (Object) from_locale
Returns the value of attribute from_locale
5 6 7 |
# File 'lib/translate/log.rb', line 5 def from_locale @from_locale end |
- (Object) keys
Returns the value of attribute keys
5 6 7 |
# File 'lib/translate/log.rb', line 5 def keys @keys end |
- (Object) to_locale
Returns the value of attribute to_locale
5 6 7 |
# File 'lib/translate/log.rb', line 5 def to_locale @to_locale end |
Instance Method Details
- (Object) read
19 20 21 |
# File 'lib/translate/log.rb', line 19 def read file.read end |
- (Object) write_to_file
13 14 15 16 17 |
# File 'lib/translate/log.rb', line 13 def write_to_file current_texts = File.exists?(file_path) ? file.read : {} current_texts.merge!(from_texts) file.write(current_texts) end |