class AdLocalize::Mappers::TranslationMapper

Public Instance Methods

map(translation:) click to toggle source
# File lib/ad_localize/mappers/translation_mapper.rb, line 4
def map(translation:)
  ViewModels::TranslationViewModel.new(
    label: translation.key.label,
    key: key(translation: translation),
    value: sanitize_value(value: translation.value),
    comment: translation.comment
  )
end

Protected Instance Methods

sanitize_value(value:) click to toggle source
# File lib/ad_localize/mappers/translation_mapper.rb, line 15
def sanitize_value(value:)
  value
end

Private Instance Methods

key(translation:) click to toggle source
# File lib/ad_localize/mappers/translation_mapper.rb, line 21
def key(translation:)
  if translation.key.plural?
    translation.key.plural_key
  elsif translation.key.adaptive?
    translation.key.adaptive_key
  end
end