kit-contract edge

MethodWrapper module
Kit::Contract::Services::MethodWrapper
View Source

Logic to rewrite methods in order to add signature contracts.


Link to this section Summary ⚠️ Private APIs are currently hidden.


Link to this section Class methods 3

Link to this method

.create_alias(extension_target:, method_name:, aliased_name:)

View Source

Rename the method so that we can replace it by a wrapped version that will be able to enforce contracts

Link to this method

.create_method_wrapper(extension_target:, target_class:, method_name:, method_type:, aliased_name:, contracts_before_uid:, contracts_after_uid:)

View Source
🗒 Notes:
  • We are forced to avoid splat as it makes it impossible to perform any introspection on the parameters of the method. This leads to this akward parameter forwarding.

Replaces the initial method by a wrapped version that will run contracts before & after the original method.

Link to this method

.wrap(method_name:, method_type:, class_self:, contracts_before:, contracts_after:)

View Source

Link to this section Constants 1