Class: RailsTranslationManager::Importer
- Inherits:
-
Object
- Object
- RailsTranslationManager::Importer
- Includes:
- YAMLWriter
- Defined in:
- lib/rails_translation_manager/importer.rb
Instance Attribute Summary collapse
-
#csv_path ⇒ Object
readonly
Returns the value of attribute csv_path.
-
#import_directory ⇒ Object
readonly
Returns the value of attribute import_directory.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#multiple_files_per_language ⇒ Object
readonly
Returns the value of attribute multiple_files_per_language.
Instance Method Summary collapse
- #import ⇒ Object
-
#initialize(locale:, csv_path:, import_directory:, multiple_files_per_language:) ⇒ Importer
constructor
A new instance of Importer.
Methods included from YAMLWriter
Constructor Details
#initialize(locale:, csv_path:, import_directory:, multiple_files_per_language:) ⇒ Importer
Returns a new instance of Importer.
10 11 12 13 14 15 |
# File 'lib/rails_translation_manager/importer.rb', line 10 def initialize(locale:, csv_path:, import_directory:, multiple_files_per_language:) @locale = locale @csv_path = csv_path @import_directory = import_directory @multiple_files_per_language = multiple_files_per_language end |
Instance Attribute Details
#csv_path ⇒ Object (readonly)
Returns the value of attribute csv_path.
8 9 10 |
# File 'lib/rails_translation_manager/importer.rb', line 8 def csv_path @csv_path end |
#import_directory ⇒ Object (readonly)
Returns the value of attribute import_directory.
8 9 10 |
# File 'lib/rails_translation_manager/importer.rb', line 8 def import_directory @import_directory end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
8 9 10 |
# File 'lib/rails_translation_manager/importer.rb', line 8 def locale @locale end |
#multiple_files_per_language ⇒ Object (readonly)
Returns the value of attribute multiple_files_per_language.
8 9 10 |
# File 'lib/rails_translation_manager/importer.rb', line 8 def multiple_files_per_language @multiple_files_per_language end |
Instance Method Details
#import ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/rails_translation_manager/importer.rb', line 17 def import csv = reject_nil_keys( CSV.read(csv_path, encoding: "bom|utf-8", headers: true, header_converters: :downcase) ) multiple_files_per_language ? import_csv_into_multiple_files(csv) : import_csv(csv) end |