Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
6 additions
and
6 deletions.
-
+6
−6
lib-topaz/hash.rb
|
@@ -137,14 +137,14 @@ def inspect |
|
|
def select!(&block) |
|
|
return enum_for(:select!) unless block |
|
|
raise RuntimeError.new("can't modify frozen #{self.class}") if frozen? |
|
|
delete_p = false |
|
|
modified = false |
|
|
each_pair do |key, value| |
|
|
unless yield key, value |
|
|
delete key |
|
|
delete_p = true |
|
|
modified = true |
|
|
end |
|
|
end |
|
|
delete_p ? self : nil |
|
|
modified ? self : nil |
|
|
end |
|
|
|
|
|
def keep_if(&block) |
|
@@ -162,14 +162,14 @@ def select(&block) |
|
|
def reject!(&block) |
|
|
return enum_for(:reject!) unless block |
|
|
raise RuntimeError.new("can't modify frozen #{self.class}") if frozen? |
|
|
delete_p = false |
|
|
modified = false |
|
|
each_pair do |key, value| |
|
|
if yield key, value |
|
|
delete key |
|
|
delete_p = true |
|
|
modified = true |
|
|
end |
|
|
end |
|
|
delete_p ? self : nil |
|
|
modified ? self : nil |
|
|
end |
|
|
|
|
|
def delete_if(&block) |
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
This comment has been minimized.
I'm sorry to trouble you. :(
This comment has been minimized.
Don't worry about it!