Class: C11n::Importer::GoogleDrive
- Inherits:
-
Object
- Object
- C11n::Importer::GoogleDrive
- Defined in:
- lib/c11n/importer/google_drive.rb
Instance Method Summary collapse
- #categories ⇒ Object
- #import ⇒ Object
-
#initialize(options = {}) ⇒ GoogleDrive
constructor
A new instance of GoogleDrive.
- #table ⇒ Object
- #types ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ GoogleDrive
Returns a new instance of GoogleDrive.
7 8 9 |
# File 'lib/c11n/importer/google_drive.rb', line 7 def initialize( = {}) @driver = C11n::External::GoogleDriveDriver.new() end |
Instance Method Details
#categories ⇒ Object
27 28 29 |
# File 'lib/c11n/importer/google_drive.rb', line 27 def categories {} end |
#import ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/c11n/importer/google_drive.rb', line 15 def import deserialized = {} table.to_hash.each do |locale, translations| deserialized[locale] = translations.inject({}) do |result, key_and_translation| result.merge key_and_translation.first => deserialize(key_and_translation.last, types[key_and_translation.first]) end end deserialized end |
#table ⇒ Object
11 12 13 |
# File 'lib/c11n/importer/google_drive.rb', line 11 def table @table ||= C11n::Table.new(@driver.table) end |
#types ⇒ Object
31 32 33 |
# File 'lib/c11n/importer/google_drive.rb', line 31 def types table.types end |