Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
70
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
120
Rails and the Internet of Things
bryce
1
75
It's Not Ruby, But…
bryce
0
56
docker for rubyists
bryce
0
110
Would You Like To Make A Game?
bryce
0
60
WebSockets and ActionCable
bryce
0
88
How I Learned to Stop Worrying and Like RSpec
bryce
0
80
How Do Computers Even Work?
bryce
1
200
Growing Distributed Systems: Abril Pro Ruby
bryce
0
54
Other Decks in Programming
See All in Programming
ゲームの物理 剛体編
fadis
0
370
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
120
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
130
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
410
Go コードベースの構成と AI コンテキスト定義
andpad
0
140
tparseでgo testの出力を見やすくする
utgwkk
2
270
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
440
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
130
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
890
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
0
160
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
140
ローカルLLMを⽤いてコード補完を⾏う VSCode拡張機能を作ってみた
nearme_tech
PRO
0
150
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
80
Raft: Consensus for Rubyists
vanstee
141
7.3k
Six Lessons from altMBA
skipperchong
29
4.1k
The Language of Interfaces
destraynor
162
25k
Fireside Chat
paigeccino
41
3.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Utilizing Notion as your number one productivity tool
mfonobong
2
190
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
260
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
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