Class: C11n::Exporter::GoogleDrive

Inherits:
Object
  • Object
show all
Defined in:
lib/c11n/exporter/google_drive.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ GoogleDrive

Returns a new instance of GoogleDrive.



7
8
9
# File 'lib/c11n/exporter/google_drive.rb', line 7

def initialize(options = {})
  @driver = C11n::External::GoogleDriveDriver.new(options)
end

Instance Method Details

#export(translations, locale) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/c11n/exporter/google_drive.rb', line 15

def export(translations, locale)
  translations.translations_for(locale).each do |key, translation|
    serialized_translation = serialize(translation, translations.types[key])
    table.set(locale, key, serialized_translation, type: translations.types[key], category: translations.categories[key])
  end

  export_table(table)
end

#export_table(table) ⇒ Object



24
25
26
# File 'lib/c11n/exporter/google_drive.rb', line 24

def export_table(table)
  @driver.write_table(table.rows)
end

#tableObject



11
12
13
# File 'lib/c11n/exporter/google_drive.rb', line 11

def table
  @table ||= C11n::Table.new(@driver.table)
end