Skip to content

Commit

Permalink
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions truffle/src/main/ruby/core/hash.rb
Original file line number Diff line number Diff line change
@@ -37,11 +37,7 @@ class Hash

def self.contains_all_internal(one, two)
one.all? do |key, value|
begin
value === two.fetch(key)
rescue KeyError
false
end
two.has_key?(key) && (value.equal?(two[key]) || value == two[key])
end
end

2 comments on commit 5a9505a

@eregon
Copy link
Member

@eregon eregon commented on 5a9505a Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍
Maybe save the lookup of the value in the second hash in a local to avoid duplicated lookup?

@bjfish
Copy link
Contributor Author

@bjfish bjfish commented on 5a9505a Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eregon Saving the lookup here: a4a6e62 , thanks

Please sign in to comment.