Actions
Feature #9174
openvalue receiving block for Hash#has_key?
Status:
Open
Assignee:
-
Target version:
-
Description
Seems useful to be able to check for presence (as opposed to falsyness) and receive the value
class Hash
def has_key?(key, &block)
val = fetch(key){return false}
block.(val) if block
true
end
end
if h.has_key? :key do |val|
end; else
end
No data to display
Actions
Like0