Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby 2.5: What's New and What's Cool
Search
Bryce "BonzoESC" Kerley
January 15, 2018
Programming
0
62
Ruby 2.5: What's New and What's Cool
Miami Ruby Brigade
Monday, January 15, 2018
Bryce "BonzoESC" Kerley
January 15, 2018
Tweet
Share
More Decks by Bryce "BonzoESC" Kerley
See All by Bryce "BonzoESC" Kerley
Ruby in 2020
bryce
1
110
Rails and the Internet of Things
bryce
1
68
It's Not Ruby, But…
bryce
0
49
docker for rubyists
bryce
0
110
Would You Like To Make A Game?
bryce
0
52
WebSockets and ActionCable
bryce
0
83
How I Learned to Stop Worrying and Like RSpec
bryce
0
77
How Do Computers Even Work?
bryce
1
180
Growing Distributed Systems: Abril Pro Ruby
bryce
0
52
Other Decks in Programming
See All in Programming
A2A プロトコルを試してみる
azukiazusa1
2
770
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
240
XSLTで作るBrainfuck処理系
makki_d
0
210
C++20 射影変換
faithandbrave
0
500
Select API from Kotlin Coroutine
jmatsu
1
180
コード書くの好きな人向けAIコーディング活用tips #orestudy
77web
3
320
すべてのコンテキストを、 ユーザー価値に変える
applism118
1
360
Go1.25からのGOMAXPROCS
kuro_kurorrr
1
770
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
0
3k
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
1
220
今ならAmazon ECSのサービス間通信をどう選ぶか / Selection of ECS Interservice Communication 2025
tkikuc
11
2.7k
F#で自在につくる静的ブログサイト - 関数型まつり2025
pizzacat83
0
310
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
920
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
A Tale of Four Properties
chriscoyier
159
23k
Designing for Performance
lara
609
69k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
GraphQLとの向き合い方2022年版
quramy
46
14k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
The Cult of Friendly URLs
andyhume
79
6.4k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
Six Lessons from altMBA
skipperchong
28
3.8k
Transcript
Ruby 2.5 What's New and What's Cool Miami Ruby Brigade
Monday, January 15, 2018
tl;dr • feature and performance update release • new features
are cool • some stuff is faster • some stdlibs are now default gems • some other bits & bobs have changed
Topics • Intro • Features • Demos • Q&A
https://www.ruby-lang.org/en/news/2017/12/25/ruby-2-5-0-released/
Getting Ruby 2.5 • rbenv • Docker hub • Heroku
• rvm
Running an App? Go for it (With adequate testing)
Maintaining a Library? Know it exists and test with it
do / rescue / end Exception handling in a block
doesn't require begin
https://github.com/bkerley/mastodon/commit/589cdff
Object#yield_self Similar to #tap but it returns the result instead
of the receiver
None
Hash#slice Grabs a sub-hash with the given keys
https://github.com/bkerley/tides_and_currents/commit/bbb8ab78
Hash#transform_keys • Returns a new hash with the keys mapped
to something new
None
Struct.new keyword Struct#new supports keyword arguments now
None
Enumerable#any? #all? #none? #one? threequals Find if members in a
collection threequal some pattern
None
None
Reverse backtraces • Quality of life • On a terminal,
unless you change $stderr, the most recent call is at the bottom instead of a million screens up
None
Topics • Intro • Features • Demos • Q&A
Upgrading Mastodon I decided to make Mastodon work in Ruby
2.5
Mastodon • Twitter-like • Open-source • Federated • Independent nodes
Setup Steps From a new Mastodon checkout on v2.1.3, and
after Development setup steps 1. Update README.md to note that it's a weird research project 2. Remove "< 2.5.0" constraint on Ruby version from Gemfile 3. bundle 4. Some deps also have "< 2.5.0" ruby constraint 5. bundle update
app/models/media_attachment.rb def populate_meta meta = {} file.queued_for_write.each
do |style, file| begin geo = Paperclip::Geometry.from_file file meta[style] = { width: geo.width.to_i, height: geo.height.to_i, size: "#{geo.width.to_i}x#{geo.height.to_i}", aspect: geo.width.to_f / geo.height.to_f, } rescue Paperclip::Errors::NotIdentifiedByImageMagickError meta[style] = {} end end meta end
None
app/models/media_attachment.rb def populate_meta meta = {} file.queued_for_write.each
do |style, file| begin geo = Paperclip::Geometry.from_file file meta[style] = { width: geo.width.to_i, height: geo.height.to_i, size: "#{geo.width.to_i}x#{geo.height.to_i}", aspect: geo.width.to_f / geo.height.to_f, } # rescue Paperclip::Errors::NotIdentifiedByImageMagickError # meta[style] = {} end end meta end
None
app/models/media_attachment.rb def populate_meta meta = {} file.queued_for_write.each
do |style, file| geo = Paperclip::Geometry.from_file file meta[style] = { width: geo.width.to_i, height: geo.height.to_i, size: "#{geo.width.to_i}x#{geo.height.to_i}", aspect: geo.width.to_f / geo.height.to_f, } rescue Paperclip::Errors::NotIdentifiedByImageMagickError meta[style] = {} end meta end
None
https://github.com/bkerley/mastodon/commit/589cdff
tides_and_currents • Code for Miami project • Gets tides and
currents data from NOAA • Quick and dirty ruby scripts
get_stations.rb field_names = %w{geoGroupName stationId lat lon} #
… out_json = doc['stationList'].map do |stn| # … field_names.map do |fn| stn[fn] end end.compact
None
get_stations.rb field_names = %w{geoGroupName stationId lat lon} #
… out_json = doc['stationList'].map do |stn| # … stn.slice(*field_names).values end.compact
None
https://github.com/bkerley/tides_and_currents/commit/bbb8ab78
Topics • Intro • Features • Demos • Q&A
Thanks