Sha256: 7c5798930a9141bbaece7679afe3e2306ab201956992f8a71e7d1ae83d51a92e

Contents?: true

Size: 437 Bytes

Versions: 3

Compression:

Stored size: 437 Bytes

Contents

# frozen_string_literal: true

module Nocode
  module Steps
    module Io
      # Delete the specified path.  Does nothing if the file does not exist.
      class Delete < Step
        option :path

        def perform
          return if path.to_s.empty?

          FileUtils.rm_f(path) if File.exist?(path)
        end

        private

        def path
          File.join(*array(path_option))
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nocode-0.0.10 lib/nocode/steps/io/delete.rb
nocode-0.0.9 lib/nocode/steps/io/delete.rb
nocode-0.0.8 lib/nocode/steps/io/delete.rb