Sha256: 49505150a4b2c97933479768648666edde1630090eaacf97fe46df32d3de38da

Contents?: true

Size: 617 Bytes

Versions: 4

Compression:

Stored size: 617 Bytes

Contents

# frozen_string_literal: true
require 'fileutils'
require 'agave/dump/format'

module Agave
  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

4 entries across 4 versions & 1 rubygems

Version Path
agave-client-0.1.3 lib/agave/dump/operation/create_data_file.rb
agave-client-0.1.2 lib/agave/dump/operation/create_data_file.rb
agave-client-0.1.1 lib/agave/dump/operation/create_data_file.rb
agave-client-0.1.0 lib/agave/dump/operation/create_data_file.rb