Sha256: 1496dfe0e2d71cd648e6f48c592d6ccc25661929b434635e0096888b270b7e24

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Examples
    module Standard
      class Gemfile
        module Services
          class AssertFileExists
            include ConvenientService::Standard::Config

            attr_reader :path

            def initialize(path:)
              @path = path
            end

            def result
              return failure(path: "Path is `nil`") if path.nil?
              return failure(path: "Path is empty") if path.empty?

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

              success
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convenient_service-0.13.0 lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb