Sha256: b94ebf7e37ddc6f947b9d0745b667fb846dd7732cff9cffbf799927a96bff765
Contents?: true
Size: 985 Bytes
Versions: 5
Compression:
Stored size: 985 Bytes
Contents
# frozen_string_literal: true module ConvenientService module Examples module Rails class Gemfile module Services class ReplaceFileContent include RailsService::Config attribute :path, :string attribute :content, :string validates :path, presence: true if ConvenientService::Dependencies.support_has_j_send_result_params_validations_using_active_model_validations? validate :content_not_nil if ConvenientService::Dependencies.support_has_j_send_result_params_validations_using_active_model_validations? step Services::AssertFileExists, in: :path step :result, in: :path def result ::File.write(path, content) success end private def content_not_nil errors.add(:content, "can't be nil") if content.nil? end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems