Sha256: f060c2267b4c9fc3764ac18636bdf2d8a42e749d8313297abf7e68e2f868d9c4

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

# frozen_string_literal: true

# rubocop:disable Lint/RescueException
class Solid::Process
  module Caller
    def call(arg = nil)
      output_already_set! if output?

      self.input = arg

      run_callbacks(:call) do
        ::BCDD::Result.event_logs(name: self.class.name) do
          self.output =
            if dependencies&.invalid?
              Failure(:invalid_dependencies, dependencies: dependencies)
            elsif input.invalid?
              Failure(:invalid_input, input: input)
            else
              super(input.attributes.deep_symbolize_keys)
            end
        rescue ::Exception => exception
          rescue_with_handler(exception) || raise

          output
        end
      end

      run_callbacks(:success) if output.success?
      run_callbacks(:failure) if output.failure?

      output
    end
  end
end
# rubocop:enable Lint/RescueException

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solid-process-0.2.0 lib/solid/process/caller.rb