Class: C11n::Exporter::GoogleDrive
- Inherits:
-
Object
- Object
- C11n::Exporter::GoogleDrive
- Defined in:
- lib/c11n/exporter/google_drive.rb
Instance Method Summary collapse
- #export(translations, locale) ⇒ Object
- #export_table(table) ⇒ Object
-
#initialize(options = {}) ⇒ GoogleDrive
constructor
A new instance of GoogleDrive.
- #table ⇒ Object
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( = {}) @driver = C11n::External::GoogleDriveDriver.new() 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 |