Sha256: 1d082ff48272ea3f265b6b94122bb2eb9c1d1cdce2f4a4fdb5562aa311391020

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Examples
    module Dry
      module Gemfile
        module Services
          class AssertFileExists
            include DryService::Config

            option :path

            contract do
              schema do
                required(:path).value(:string)
              end
            end

            def result
              return error("File with path `#{path}` does NOT exist") unless ::File.exist?(path)

              success
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
convenient_service-0.2.0 lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb
convenient_service-0.1.0 lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb