Sha256: fa340d7c5b36369c8698ebfcce8221f563f55748a26a02f0526df6414ac4d4dd

Contents?: true

Size: 528 Bytes

Versions: 2

Compression:

Stored size: 528 Bytes

Contents

module Tolk
  class Export
    attr_reader :name, :data, :destination

    def initialize(args)
      @name = args.fetch(:name, '')
      @data = args.fetch(:data, {})
      @destination = args.fetch(:destination, self.class.dump_path)
    end

    def dump
      File.open("#{destination}/#{name}.yml", "w+") do |file|
        file.write(YAML.dump(data))
      end
    end

    class << self
      def dump(args)
        new(args).dump
      end

      def dump_path
        Tolk::Locale._dump_path
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tolk-6.0.0 lib/tolk/export.rb
tolk-6.0.0.alpha1 lib/tolk/export.rb