mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Proc
made by Symbol#to_proc
should be a lambda [Bug #16260]
This commit is contained in:
parent
90d082e374
commit
f0b815dc67
3 changed files with 10 additions and 1 deletions
8
NEWS.md
8
NEWS.md
|
@ -34,6 +34,13 @@ sufficient information, see the ChangeLog file or Redmine
|
|||
* Hash#transform_keys now accepts a hash that maps keys to new
|
||||
keys. [[Feature #16274]]
|
||||
|
||||
* Symbol
|
||||
|
||||
* Modified method
|
||||
|
||||
* Symbol#to_proc now returns a lambda Proc.
|
||||
[[Feature #16260]]
|
||||
|
||||
## Stdlib updates (outstanding ones only)
|
||||
|
||||
* Net::HTTP
|
||||
|
@ -71,6 +78,7 @@ sufficient information, see the ChangeLog file or Redmine
|
|||
[Feature #8948]: https://bugs.ruby-lang.org/issues/8948
|
||||
[Feature #15575]: https://bugs.ruby-lang.org/issues/15575
|
||||
[Feature #16131]: https://bugs.ruby-lang.org/issues/16131
|
||||
[Feature #16260]: https://bugs.ruby-lang.org/issues/16260
|
||||
[Feature #16274]: https://bugs.ruby-lang.org/issues/16274
|
||||
[Feature #16377]: https://bugs.ruby-lang.org/issues/16377
|
||||
[Feature #16555]: https://bugs.ruby-lang.org/issues/16555
|
||||
|
|
1
proc.c
1
proc.c
|
@ -697,6 +697,7 @@ sym_proc_new(VALUE klass, VALUE sym)
|
|||
GetProcPtr(procval, proc);
|
||||
|
||||
vm_block_type_set(&proc->block, block_type_symbol);
|
||||
proc->is_lambda = TRUE;
|
||||
RB_OBJ_WRITE(procval, &proc->block.as.symbol, sym);
|
||||
return procval;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ describe :proc_to_s, shared: true do
|
|||
describe "for a proc created with Symbol#to_proc" do
|
||||
it "returns a description including '(&:symbol)'" do
|
||||
proc = :foobar.to_proc
|
||||
proc.send(@method).should =~ /^#<Proc:0x\h+\(&:foobar\)>$/
|
||||
proc.send(@method).should.include?('(&:foobar)')
|
||||
end
|
||||
|
||||
it "has a binary encoding" do
|
||||
|
|
Loading…
Add table
Reference in a new issue