Sha256: 86f53484af37495ae053ac414025f8e60ab8e56fc0957a04d7f6ce8f05b13d77

Contents?: true

Size: 747 Bytes

Versions: 4

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Examples
    module Standard
      module V1
        class Gemfile
          module Services
            class AssertFileExists
              include ConvenientService::Standard::V1::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
end

Version data entries

4 entries across 4 versions & 1 rubygems

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