Sha256: 26c3e34ed1b0551df48665744160ae0ad5ad3a85e53fba82bc0130236c82b0f3

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

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

            attr_reader :path

            def initialize(path:)
              @path = path
            end

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

              return error(message: "File with path `#{path}` is empty") if ::File.zero?(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_not_empty.rb