Class: Locomotive::Mounter::Writer::FileSystem::TranslationsWriter
- Defined in:
- lib/locomotive/mounter/writer/file_system/translations_writer.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#create_folder, #initialize, #open_file, #target_path
Constructor Details
This class inherits a constructor from Locomotive::Mounter::Writer::FileSystem::Base
Instance Method Details
#prepare ⇒ Object
8 9 10 11 |
# File 'lib/locomotive/mounter/writer/file_system/translations_writer.rb', line 8 def prepare super self.create_folder 'config' end |
#write ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/locomotive/mounter/writer/file_system/translations_writer.rb', line 13 def write content = self.mounting_point.translations.each_with_object({}) do |(key,translation), hash| hash[key] = translation.values end content = content.empty? ? '' : content.to_yaml self.open_file('config/translations.yml') do |file| file.write content end end |