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



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_localeObject

Returns the value of attribute from_locale



5
6
7
# File 'lib/translate/log.rb', line 5

def from_locale
  @from_locale
end

#keysObject

Returns the value of attribute keys



5
6
7
# File 'lib/translate/log.rb', line 5

def keys
  @keys
end

#to_localeObject

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

#readObject



19
20
21
# File 'lib/translate/log.rb', line 19

def read
  file.read
end

#write_to_fileObject



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