Skip to content

Commit

Permalink
add keyrest to match? (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
cosimaradu authored Mar 19, 2024
1 parent 29bba49 commit 3293eb4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/sinject/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3293eb4

Please sign in to comment.