Skip to content
This repository

Hash#select! returns enumerator when self is a frozen object and no block given #2278

Merged
merged 3 commits into from about 1 year ago

2 participants

Kenichi Kamiya Dirkjan Bussink
Kenichi Kamiya
Collaborator

No description provided.

Dirkjan Bussink dbussink merged commit 4654819 into from April 15, 2013
Dirkjan Bussink dbussink closed this April 15, 2013
Kenichi Kamiya kachick deleted the branch April 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
4  kernel/common/hash19.rb
@@ -427,10 +427,10 @@ def select
427 427
   end
428 428
 
429 429
   def select!
430  
-    Rubinius.check_frozen
431  
-
432 430
     return to_enum(:select!) unless block_given?
433 431
 
  432
+    Rubinius.check_frozen
  433
+
434 434
     return nil if empty?
435 435
 
436 436
     size = @size
3  spec/ruby/core/hash/select_spec.rb
@@ -61,6 +61,7 @@
61 61
     end
62 62
   end
63 63
 
  64
+  it_behaves_like(:hash_iteration_no_block, :select)
64 65
 end
65 66
 
66 67
 ruby_version_is "1.9" do
@@ -91,5 +92,7 @@
91 92
     it "raises a RuntimeError if called on a frozen instance that would not be modified" do
92 93
       lambda { HashSpecs.frozen_hash.select! { true } }.should raise_error(RuntimeError)
93 94
     end
  95
+
  96
+    it_behaves_like(:hash_iteration_no_block, :select!)
94 97
   end
95 98
 end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.