Sha256: 693a04e0d68f1b6ee97714661881363d1804059daacfaf5a6688e0ee6a2bc452

Contents?: true

Size: 669 Bytes

Versions: 4

Compression:

Stored size: 669 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 error("Path is `nil`") if path.nil?
              return error("Path is empty") if path.empty?

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

              success
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
convenient_service-0.17.0 lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb
convenient_service-0.16.0 lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb
convenient_service-0.15.0 lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb
convenient_service-0.14.0 lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb