Sha256: d025f35c798a6506cc77ffaee618db428563c06d798e8e7f3dc5582ef21bfde3
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
# frozen_string_literal: true module ConvenientService module Examples module Standard module Gemfile module Services class MergeSections include ConvenientService::Standard::Config ## # IMPORTANT: # - `CanHaveMethodSteps` is disabled in the Standard config since it causes race conditions in combination with `CanHaveStubbedResult`. # - It will be reenabled after the introduction of thread-safety specs. # - Do not use it in production yet. # middlewares :step, scope: :class do use ConvenientService::Plugins::Service::CanHaveMethodSteps::Middleware end attr_reader :header, :body step :validate_header, in: :header step :validate_body, in: :body step :result, in: [ :header, :body ] def initialize(header:, body:) @header = header @body = body end def result success(merged_sections: "#{header}\n#{body}") end def validate_header return failure(header: "Header is `nil`") if header.nil? return failure(header: "Header is empty") if header.empty? success end def validate_body return failure(body: "Body is `nil`") if body.nil? return failure(body: "Body is empty") if body.empty? success end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
convenient_service-0.11.0 | lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb |