class Locomotive::Wagon::PullTranslationsCommand

Public Instance Methods

_pull() click to toggle source
# File lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb, line 5
def _pull
  translations = api_client.translations.all.inject({}) do |hash, translation|
    translation.values.delete_if { |locale, _| !locales.include?(locale) }
    hash[translation.key] = translation.values
    hash
  end

  unless translations.empty?
    write_translations(translations)
  end
end

Private Instance Methods

translations_filepath() click to toggle source
# File lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb, line 23
def translations_filepath
  File.join('config', 'translations.yml')
end
write_translations(translations) click to toggle source
# File lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb, line 19
def write_translations(translations)
  write_to_file(translations_filepath, dump(translations))
end