Skip to content

Commit

Permalink
Fix ENV.delete with block
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Apr 5, 2012
1 parent aebaa23 commit 8141ff4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kernel/common/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ def each

def delete(key)
existing_value = self[key]
self[key] = nil if existing_value
if existing_value
self[key] = nil
elsif block_given?
yield key
end
existing_value
end

Expand Down

0 comments on commit 8141ff4

Please sign in to comment.