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)