Class: TypedOperation::Prepared

Inherits:
PartiallyApplied show all
Defined in:
lib/typed_operation/prepared.rb

Overview

Represents an operation with all required parameters provided and ready for execution. Created when a PartiallyApplied operation receives its final required parameters.

Instance Attribute Summary

Attributes inherited from PartiallyApplied

#keyword_args, #operation_class, #positional_args

Instance Method Summary collapse

Methods inherited from PartiallyApplied

#call, #curry, #deconstruct, #deconstruct_keys, #initialize, #to_proc, #with

Methods included from Operations::Composition

#or_else, #then, #then_passes, #then_spreads, #transform

Constructor Details

This class inherits a constructor from TypedOperation::PartiallyApplied

Instance Method Details

#explainObject

: () -> untyped



19
20
21
22
23
24
# File 'lib/typed_operation/prepared.rb', line 19

def explain
  unless operation_class.respond_to?(:explain)
    raise InvalidOperationError, "#{operation_class.name} does not support .explain. Include TypedOperation::Explainable in your operation class."
  end
  operation_class.explain(*@positional_args, **@keyword_args)
end

#operationObject

: () -> TypedOperation::Base



9
10
11
# File 'lib/typed_operation/prepared.rb', line 9

def operation
  operation_class.new(*@positional_args, **@keyword_args)
end

#prepared?Boolean

: () -> true

Returns:

  • (Boolean)


14
15
16
# File 'lib/typed_operation/prepared.rb', line 14

def prepared?
  true
end