Sha256: c52ff23f8b7a20a85405b8284e97956c155c48a100a95019b3e7b0f3405fffdd

Contents?: true

Size: 669 Bytes

Versions: 4

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Examples
    module Dry
      class Gemfile
        module Services
          class ReadFileContent
            include DryService::Config

            option :path

            contract do
              schema do
                required(:path).filled(:string)
              end
            end

            step Services::AssertFileExists, in: :path
            step Services::AssertFileNotEmpty, in: :path
            step :result, in: :path, out: :content

            def result
              success(content: ::File.read(path))
            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/dry/gemfile/services/read_file_content.rb
convenient_service-0.16.0 lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb
convenient_service-0.15.0 lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb
convenient_service-0.14.0 lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb