Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ruby 2.5: What's New and What's Cool
Search
Bryce "BonzoESC" Kerley
January 15, 2018
Programming
99
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby 2.5: What's New and What's Cool
Miami Ruby Brigade
Monday, January 15, 2018
Bryce "BonzoESC" Kerley
January 15, 2018
More Decks by Bryce "BonzoESC" Kerley
See All by Bryce "BonzoESC" Kerley
Ruby in 2020
bryce
1
130
Rails and the Internet of Things
bryce
1
94
It's Not Ruby, But…
bryce
0
91
docker for rubyists
bryce
0
130
Would You Like To Make A Game?
bryce
0
69
WebSockets and ActionCable
bryce
0
97
How I Learned to Stop Worrying and Like RSpec
bryce
0
95
How Do Computers Even Work?
bryce
1
230
Growing Distributed Systems: Abril Pro Ruby
bryce
0
61
Other Decks in Programming
See All in Programming
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
990
高専キャリア LT 発表内容
crysta1221
6
5.7k
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
190
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
2.8k
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
520
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
320
XHTMLが残したもの
yosuke_furukawa
PRO
2
780
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
190
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
Heart of Swift Concurrency
koher
0
540
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
320
Featured
See All Featured
Faster Mobile Websites
deanohume
310
32k
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
The Cost Of JavaScript in 2023
addyosmani
55
10k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
Embracing the Ebb and Flow
colly
88
5.2k
Accessibility Awareness
sabderemane
1
210
Joys of Absence: A Defence of Solitary Play
codingconduct
1
510
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
Building the Perfect Custom Keyboard
takai
2
870
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Agile that works and the tools we love
rasmusluckow
331
22k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
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