Skip to content

Commit

Permalink
Do not use a second lookup for the contract in StrictHash assertion
Browse files Browse the repository at this point in the history
`all?` iterator already provides contract for the `valid?` check. Use
it instead of accessing `contract_hash` again.
  • Loading branch information
smt116 committed Apr 20, 2017
1 parent 89b9ca2 commit ca00d28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/contracts/builtin_contracts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ def valid?(arg)
return false unless arg.is_a?(Hash)
return false unless arg.keys.sort.eql?(contract_hash.keys.sort)

contract_hash.all? do |key, _v|
contract_hash.key?(key) && Contract.valid?(arg[key], contract_hash[key])
contract_hash.all? do |key, contract|
contract_hash.key?(key) && Contract.valid?(arg[key], contract)
end
end
end
Expand Down

0 comments on commit ca00d28

Please sign in to comment.