Sha256: 62f4efc0574cd89c0dead1a9e6fddd62f1dd6144cd1d73bf34983b45566ba410
Contents?: true
Size: 586 Bytes
Versions: 5
Compression:
Stored size: 586 Bytes
Contents
require "translations/translation_collection" require "yaml" module Translations class Serializer def initialize directory, master @directory = directory @master = master end def translations TranslationCollection.new Dir["#{@directory}/*"].map { |file| Translation.new YAML.load_file(file) }, @master end def save translations translations.each do |translation| File.open File.join(@directory, "#{translation.locale}.yml"), "w" do |file| file.write translation.to_hash.to_yaml end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems