Sha256: dfedcd70a29d09d60fa2e1aacf6299f1ecb8e5f554b012ba1e272ab65dec1179

Contents?: true

Size: 616 Bytes

Versions: 26

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

require 'fileutils'
require 'dato/dump/format'

module Dato
  module Dump
    module Operation
      class CreateDataFile
        attr_reader :context, :path, :format, :value

        def initialize(context, path, format, value)
          @context = context
          @path = path
          @format = format
          @value = value
        end

        def perform
          FileUtils.mkdir_p(File.dirname(path))

          File.open(File.join(context.path, path), 'w') do |file|
            file.write Format.dump(format, value)
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
dato-0.8.0 lib/dato/dump/operation/create_data_file.rb
dato-0.7.18 lib/dato/dump/operation/create_data_file.rb
dato-0.7.17 lib/dato/dump/operation/create_data_file.rb
dato-0.7.16 lib/dato/dump/operation/create_data_file.rb
dato-0.7.15 lib/dato/dump/operation/create_data_file.rb
dato-0.7.14 lib/dato/dump/operation/create_data_file.rb
dato-0.7.13 lib/dato/dump/operation/create_data_file.rb
dato-0.7.10 lib/dato/dump/operation/create_data_file.rb
dato-0.7.9 lib/dato/dump/operation/create_data_file.rb
dato-0.7.8 lib/dato/dump/operation/create_data_file.rb
dato-0.7.7 lib/dato/dump/operation/create_data_file.rb
dato-0.7.6 lib/dato/dump/operation/create_data_file.rb
dato-0.7.5 lib/dato/dump/operation/create_data_file.rb
dato-0.7.4 lib/dato/dump/operation/create_data_file.rb
dato-0.7.3 lib/dato/dump/operation/create_data_file.rb
dato-0.7.2 lib/dato/dump/operation/create_data_file.rb
dato-0.7.1 lib/dato/dump/operation/create_data_file.rb
dato-0.7.0 lib/dato/dump/operation/create_data_file.rb
dato-0.6.18 lib/dato/dump/operation/create_data_file.rb
dato-0.6.17 lib/dato/dump/operation/create_data_file.rb