From 3293eb42869cbeeebf75cd900e8e299e5240ed14 Mon Sep 17 00:00:00 2001 From: Cosima Radu Date: Tue, 19 Mar 2024 14:57:17 +0000 Subject: [PATCH] add keyrest to match? (#35) --- lib/sinject/container.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/sinject/container.rb b/lib/sinject/container.rb index 77babfc..a40f250 100644 --- a/lib/sinject/container.rb +++ b/lib/sinject/container.rb @@ -163,8 +163,9 @@ def validate_contract(dependency_class, contract_class) def match?(contract, dependency) return true if contract[:type] == dependency[:type] return true if contract[:type] == :req && dependency[:type] == :opt - return true if contract[:type] == :keyreq && dependency[:type] == :key - return false + return true if [:keyreq, :keyrest].include?(contract[:type]) && dependency[:type] == :key + + false end def create_instance(item)