Class: Locomotive::Wagon::PullSnippetsCommand
- Inherits:
-
PullBaseCommand
- Object
- Struct
- PullBaseCommand
- Locomotive::Wagon::PullSnippetsCommand
- Defined in:
- lib/locomotive/wagon/commands/pull_sub_commands/pull_snippets_command.rb
Constant Summary
Constants included from AssetsConcern
Instance Attribute Summary
Attributes inherited from PullBaseCommand
#api_client, #current_site, #env, #path
Instance Method Summary collapse
Methods inherited from PullBaseCommand
#_pull_with_timezone, #clean_attributes, #default_locale, #dump, #instrument, #instrument_base_name, #is_default_locale?, #locales, pull, #pull, #reset_file, #resource_name, #write_to_file
Methods included from AssetsConcern
#replace_asset_urls, #replace_asset_urls_in_hash
Instance Method Details
#_pull ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/locomotive/wagon/commands/pull_sub_commands/pull_snippets_command.rb', line 5 def _pull locales.each do |locale| api_client.snippets.all(locale).each do |snippet| write_snippet(snippet, locale) end end end |
#write_snippet(snippet, locale = nil) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/locomotive/wagon/commands/pull_sub_commands/pull_snippets_command.rb', line 13 def write_snippet(snippet, locale = nil) if (template = snippet.template).present? _template = replace_asset_urls(template) write_to_file(snippet_filepath(snippet, locale), _template) end end |