Class: Translate::Log
- Inherits:
-
Object
- Object
- Translate::Log
- Defined in:
- lib/translate/log.rb
Instance Attribute Summary collapse
-
#from_locale ⇒ Object
Returns the value of attribute from_locale.
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#to_locale ⇒ Object
Returns the value of attribute to_locale.
Instance Method Summary collapse
-
#initialize(from_locale, to_locale, keys) ⇒ Log
constructor
A new instance of Log.
- #read ⇒ Object
- #write_to_file ⇒ Object
Constructor Details
#initialize(from_locale, to_locale, keys) ⇒ Log
Returns 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
#from_locale ⇒ Object
Returns the value of attribute from_locale.
5 6 7 |
# File 'lib/translate/log.rb', line 5 def from_locale @from_locale end |
#keys ⇒ Object
Returns the value of attribute keys.
5 6 7 |
# File 'lib/translate/log.rb', line 5 def keys @keys end |
#to_locale ⇒ Object
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
#read ⇒ Object
19 20 21 |
# File 'lib/translate/log.rb', line 19 def read file.read end |
#write_to_file ⇒ Object
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 |