class Locomotive::Steam::Adapters::Filesystem::Sanitizers::Snippet

Public Instance Methods

apply_to_entity(entity) click to toggle source
# File lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb, line 10
def apply_to_entity(entity)
  super

  use_default_template_if_missing_locale(entity)
end

Private Instance Methods

use_default_template_if_missing_locale(entity) click to toggle source
# File lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb, line 18
def use_default_template_if_missing_locale(entity)
  # if there a missing template in one of the locales,
  # then use the one from the default locale
  default = entity.template_path[default_locale]
  locales.each do |locale|
    next if locale == default_locale
    entity.template_path[locale] ||= default
  end
end