Sha256: 0889894f7f1e03ac8287de9b0eade4517b359049dc00ee67b4e50b86ad13e717
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module ConvenientService module Examples module Standard class Gemfile module Services class ReplaceFileContent include ConvenientService::Standard::Config attr_reader :path, :content step :validate_path, in: :path step :validate_content, in: :content step Services::AssertFileExists, in: :path step :result, in: :path def initialize(path:, content:) @path = path @content = content end def result ::File.write(path, content) success end private def validate_path return failure(path: "Path is `nil`") if path.nil? return failure(path: "Path is empty") if path.empty? success end def validate_content return failure(content: "Content is `nil`") if content.nil? 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/replace_file_content.rb |