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.
4 5 6 7 8 |
# File 'lib/translate/log.rb', line 4 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.
2 3 4 |
# File 'lib/translate/log.rb', line 2 def from_locale @from_locale end |
#keys ⇒ Object
Returns the value of attribute keys.
2 3 4 |
# File 'lib/translate/log.rb', line 2 def keys @keys end |
#to_locale ⇒ Object
Returns the value of attribute to_locale.
2 3 4 |
# File 'lib/translate/log.rb', line 2 def to_locale @to_locale end |
Instance Method Details
#read ⇒ Object
16 17 18 |
# File 'lib/translate/log.rb', line 16 def read file.read end |
#write_to_file ⇒ Object
10 11 12 13 14 |
# File 'lib/translate/log.rb', line 10 def write_to_file current_texts = File.exists?(file_path) ? file.read : {} current_texts.merge!(from_texts) file.write(current_texts) end |