Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby 2.5 What's New

Urabe Shyouhei
November 29, 2017

Ruby 2.5 What's New

Urabe Shyouhei

November 29, 2017
Tweet

More Decks by Urabe Shyouhei

Other Decks in Technology

Transcript

  1. EJ⒎TUBUT ˠ 1585 files changed, 147854 insertions(+), 72571 deletions(-) ˠ

    1549 files changed, 120363 insertions(+), 70385 deletions(-) ˠ 2933 files changed, 103658 insertions(+), 62082 deletions(-) ˠ 2263 files changed, 82556 insertions(+), 289978 deletions(-) ˠUSVOL 7061 files changed, 360060 insertions(+), 34025 deletions(-)
  2. ଞϥΠϒϥϦ • Rubyspec • RDoc 6 (ripper integration) • ERb#result_with_hash

    • SecureRandom.alphanumeric • Binding#irb • etc.
  3. Binding#irb def foo while true do raise unless rand <

    0.5 end rescue binding.irb # <= end
  4. ίΞΫϥε • String#delete_prefix / String#delete_suffix • Array#append / Array#prepend •

    Dir#children / Dir#each_child • Hash#transform_keys • Kernel#yield_self
  5. Array#append %w'dolor sit amet'.prepend(%w'lorem ipsum') # => [["lorem", "ipsum"], "dolor",

    "sit", "amet"] %w'dolor sit amet'.prepend('lorem', 'ipsum') # => ["lorem", "ipsum", "dolor", "sit", "amet"]
  6. จ๏ͱ͔ • do … rescue … end • Toplevel constant

    lookup removal • Reverse backtrace order
  7. do … rescue … end 128.times do |i| raise unless

    rand < 0.5 rescue RuntimeError puts $! end
  8. Reverse backtrace zsh % ruby -e 'def foo; bar; end'

    -e 'def bar; raise; end' -e 'foo' Traceback (most recent call last): 2: from -e:3:in `<main>' 1: from -e:1:in `foo' -e:2:in `bar': unhandled exception [1] 34131 exit 1 ruby -e ‘…’ zsh % ruby -e 'def foo; bar; end' -e 'def bar; raise; end' -e 'foo' 2>&1 | cat -e:2:in `bar': unhandled exception from -e:1:in `foo' from -e:3:in `<main>' [1] 34291 exit 1 ruby -e ‘…’ 2>&1 | 34292 done cat