Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Ruby 2.5 What's New
Urabe Shyouhei
November 29, 2017
Technology
0
1k
Ruby 2.5 What's New
Urabe Shyouhei
November 29, 2017
Tweet
Share
More Decks by Urabe Shyouhei
See All by Urabe Shyouhei
On sending methods
shyouhei
0
420
The send-pop optimisation
shyouhei
2
5.5k
Glitching Ruby Script
shyouhei
2
520
Being an Open Source Developer, at work
shyouhei
11
5.8k
Optimizing Ruby
shyouhei
7
1.7k
Ruby and its evaluation
shyouhei
10
2.6k
Deeper look at RFC7159 the JSON
shyouhei
4
1.1k
What's New in Ruby 2.0
shyouhei
73
24k
Other Decks in Technology
See All in Technology
1人目SETとして入社して2ヶ月の間におこなったこと
tarappo
3
390
Scrum Fest Osaka 2022 フルリモート下でのチームビルディング
moritamasami
2
890
覗いてみよう!現場のスクラムチーム
tkredman
0
930
アーキテクチャを明文化して開発に臨んだ話
akihiyo76
0
230
suppress-ts-errors を使って TypeScriptの型チェックを漸進的に強化する / Introducing-suppress-ts-errors
kawamataryo
2
100
Amazon ECRに無駄なコストがかかっていた
iwamot
0
150
LINEのB2Bプラットフォームにおけるトラブルシューティング2選
line_developers
PRO
3
270
noteの品質課題に立ち上げ直後のQAチームが挑んだ軌跡
hiroki_tanaka
1
190
データエンジニアリングの潮流を俯瞰する
tetsuroito
1
700
スクラムのスケールとチームトポロジー / Scaled Scrum and Team Topologies
daiksy
1
370
Build 2022で発表されたWindowsアプリ開発のあれこれ振り返ろう
hatsunea
1
340
UWBを使ってみた
norioikedo
0
340
Featured
See All Featured
The Language of Interfaces
destraynor
148
20k
Making the Leap to Tech Lead
cromwellryan
113
7.4k
Building an army of robots
kneath
299
40k
Testing 201, or: Great Expectations
jmmastey
21
5.4k
Automating Front-end Workflow
addyosmani
1351
200k
YesSQL, Process and Tooling at Scale
rocio
157
12k
GitHub's CSS Performance
jonrohan
1020
420k
What's new in Ruby 2.0
geeforr
336
30k
Art, The Web, and Tiny UX
lynnandtonic
280
17k
Streamline your AJAX requests with AmplifyJS and jQuery
dougneiner
126
8.5k
It's Worth the Effort
3n
172
25k
Done Done
chrislema
174
14k
Transcript
Urabe, Shyouhei Ruby 2.5 What’s New
·ͣ֓ܗ͔Β
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(-)
None
None
bundler w ͍·ͷͱ͜Ζ͓ͦΒ͘࠷ޙͷඪ४ఴϥΠϒϥϦ w ͔ΒɺઃఆෆཁͰ͍͖ͳΓGemfileΛ ͋Ε ಡΉΑ͏ʹͳΔ
ଞϥΠϒϥϦ • Rubyspec • RDoc 6 (ripper integration) • ERb#result_with_hash
• SecureRandom.alphanumeric • Binding#irb • etc.
ERb#result_with_hash erb = ERb.new("<%= foo %>") erb.result_with_hash(foo: "1") # =>
"1"
SecureRandom.alphanumeric SecureRandom.alphanumeric(32) # => "Xr3GCd3y2wkUgEF9lSh5pD2s5NDpeHSM"
Binding#irb def foo while true do raise unless rand <
0.5 end rescue binding.irb # <= end
ίΞΫϥε • String#delete_prefix / String#delete_suffix • Array#append / Array#prepend •
Dir#children / Dir#each_child • Hash#transform_keys • Kernel#yield_self
String#delete_prefix "log.fluentd.message {...".delete_prefix("log.") # => "fluentd.message {..."
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"]
Hash#transform_keys {foo: 'bar'}.transform_keys(&:to_s) # => {"foo"=>"bar"}
Kernel#yield_self {foo: 'bar'}.yield_self {|i| JSON.dump(i) } # => "{\"foo\":\"bar\"}"
จ๏ͱ͔ • do … rescue … end • Toplevel constant
lookup removal • Reverse backtrace order
do … rescue … end 128.times do |i| raise unless
rand < 0.5 rescue RuntimeError puts $! end
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