Class: Locomotive::Mounter::Writer::FileSystem::SnippetsWriter
- Defined in:
- lib/locomotive/mounter/writer/file_system/snippets_writer.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#prepare ⇒ Object
It creates the snippets folder.
-
#write ⇒ Object
It writes all the snippets into files.
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
It creates the snippets folder
9 10 11 12 |
# File 'lib/locomotive/mounter/writer/file_system/snippets_writer.rb', line 9 def prepare super self.create_folder 'app/views/snippets' end |
#write ⇒ Object
It writes all the snippets into files
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/locomotive/mounter/writer/file_system/snippets_writer.rb', line 15 def write self.mounting_point.snippets.each do |filepath, snippet| self.output_resource_op snippet # Note: we assume the current locale is the default one snippet.translated_in.each do |locale| default_locale = locale.to_sym == self.mounting_point.default_locale.to_sym Locomotive::Mounter.with_locale(locale) do self.write_snippet_to_fs(snippet, filepath, default_locale ? nil : locale) end end self.output_resource_op_status snippet end end |