Sha256: 217c6f89abac0288b1e776422bd1a5996836fad78c063e180e6d7ceda4b3449d

Contents?: true

Size: 660 Bytes

Versions: 4

Compression:

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

              return failure("File with path `#{path}` is empty") if ::File.zero?(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_not_empty.rb
convenient_service-0.16.0 lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb
convenient_service-0.15.0 lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb
convenient_service-0.14.0 lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb