mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	
							parent
							
								
									5611066e03
								
							
						
					
					
						commit
						0d3dc2ec80
					
				
				
				Notes:
				
					git
				
				2020-12-19 18:00:20 +09:00 
				
			
			
			
		
		
					 2 changed files with 6 additions and 4 deletions
				
			
		
							
								
								
									
										3
									
								
								hash.c
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								hash.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2643,7 +2643,8 @@ rb_hash_except(int argc, VALUE *argv, VALUE hash)
 | 
			
		|||
    int i;
 | 
			
		||||
    VALUE key, result;
 | 
			
		||||
 | 
			
		||||
    result = rb_obj_dup(hash);
 | 
			
		||||
    result = hash_alloc(rb_cHash);
 | 
			
		||||
    hash_copy(result, hash);
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < argc; i++) {
 | 
			
		||||
        key = argv[i];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,14 +20,15 @@ ruby_version_is "3.0" do
 | 
			
		|||
      @hash.except(:a, :chunky_bacon).should == { b: 2, c: 3 }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "returns an instance of a subclass" do
 | 
			
		||||
    it "always returns a Hash without a default" do
 | 
			
		||||
      klass = Class.new(Hash)
 | 
			
		||||
      h = klass.new
 | 
			
		||||
      h = klass.new(:default)
 | 
			
		||||
      h[:bar] = 12
 | 
			
		||||
      h[:foo] = 42
 | 
			
		||||
      r = h.except(:foo)
 | 
			
		||||
      r.should == {bar: 12}
 | 
			
		||||
      r.class.should == klass
 | 
			
		||||
      r.class.should == Hash
 | 
			
		||||
      r.default.should == nil
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue