Sha256: 278bc21b34eb71a8768a4303c916f0da9fd3e68b3dbcef9b434b06cd97cc7c11

Contents?: true

Size: 608 Bytes

Versions: 3

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Examples
    module Rails
      module Gemfile
        module Services
          class ReadFileContent
            include RailsService::Config

            attribute :path, :string

            validates :path, presence: true

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

            def result
              success(data: {content: ::File.read(path)})
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
convenient_service-0.2.1 lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb
convenient_service-0.2.0 lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb
convenient_service-0.1.0 lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb