Sha256: 20c20af0d34e2a69cab1b557791e9d58204aa81647d716986ad2b1e483a700fd
Contents?: true
Size: 1.1 KB
Versions: 7
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true # @api private # @since 0.5.0 class SmartCore::Operation::InstanceBuilder class << self # @param operation [SmartCore::Operation] # @return [void] # # @api private # @since 0.5.0 def call(operation) new(operation).call end end # @param operation [SmartCore::Operation] # @return [void] # # @api private # @since 0.5.0 def initialize(operation) @operation = operation end # @return [void] # # @api private # @since 0.5.0 def call make_operation_caller_yieldable end private # @return [SmartCore::Operation] # # @api private # @since 0.5.0 attr_reader :operation # @return [void] # # @api private # @since 0.2.0 def make_operation_caller_yieldable operation.singleton_class.prepend(Module.new do def call super.tap { |result| yield(result) if block_given? } rescue SmartCore::Operation::FatalError => error # NOTE: returns SmartCore::Operation::Fatal instance error.__operation_result__.tap { |result| yield(result) if block_given? } end end) end end
Version data entries
7 entries across 7 versions & 1 rubygems