class AdLocalize::Interactors::Platforms::ExportPropertiesLocaleWording

Public Class Methods

new() click to toggle source
# File lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb, line 5
def initialize
  @properties_serializer = Serializers::PropertiesSerializer.new
  @file_system_repository = Repositories::FileSystemRepository.new
end

Public Instance Methods

call(wording:, locale:, platform_dir:) click to toggle source
# File lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb, line 10
def call(wording:, locale:, platform_dir:)
  LOGGER.debug("Starting export Properties wording for locale #{locale}")
  locale_wording = wording.translations_for(locale: locale)
  return unless has_properties_wording?(locale_wording: locale_wording)

  content = @properties_serializer.render(locale_wording: locale_wording)
  @file_system_repository.create_directory(path: platform_dir)
  @file_system_repository.write(content: content, path: platform_dir.join("#{locale}.properties"))
  LOGGER.debug("#{locale}.properties done !")
end
should_export_locale_by_locale?() click to toggle source
# File lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb, line 21
def should_export_locale_by_locale?
  true
end

Private Instance Methods

has_properties_wording?(locale_wording:) click to toggle source
# File lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb, line 27
def has_properties_wording?(locale_wording:)
  locale_wording.has_singular_keys?
end