Class: Translate::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/translate/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_localeObject

Returns the value of attribute from_locale.



2
3
4
# File 'lib/translate/log.rb', line 2

def from_locale
  @from_locale
end

#keysObject

Returns the value of attribute keys.



2
3
4
# File 'lib/translate/log.rb', line 2

def keys
  @keys
end

#to_localeObject

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

#readObject



16
17
18
# File 'lib/translate/log.rb', line 16

def read
  file.read
end

#write_to_fileObject



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