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 Quiz
Search
pocke
October 08, 2017
Programming
680
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby Quiz
at 学生エンジニア限定LT大会
pocke
October 08, 2017
Transcript
27 slides
Ruby Quiz Oct. 8, 2017 第4回 学生エンジニア限定LT大会
I have only 5 minutes, so I'll speak very fast.
Self introduction • Pocke • Actcat, Inc. / SideCI •
RuboCop' s core developer • Student at The Open University of Japan
SideCI
Automated Code Review as a Service
Please access here! https://sideci.com
Ruby Quiz
Question
Do you write Ruby?
Ruby Quiz • You are a Ruby interpreter. ◦ You
are a parse.y. ◦ You are a YARV. • You execute ruby code, and you output result.
Quiz 1
Q. What does the code output? p(??) p(%_?_)
Answer p(??) # => "?" p(%_?_) # => "?"
Why?
A. Why does it output "?"? p(??) p(%_?_) %<any character>…<any
character> is a string literal. e.g.) %_?_ == "?" , %!???! == "???" ?_ is a character literal. e.g.) ?_ == "_" , ?? == "?"
Quiz 2
Q. What does the code output? p(????::?:) p(% %s% %%%%)
Answer p(????::?:) # => ":" p(% %s% %%%%) # =>
"%"
Why????
Answer p(????::?:) p(% %s% %%%%) 1. ?? is "?" 2.
? is a part of conditional op 3. ?: is ":" 4. : is a part of conditional op 5. ?: is ":" "?" ? ":" : ":" 1. % %s% is "%s%" 2. % is a format op(Like sprintf) 3. %%% is "" sprintf("%s%", "")
Quiz 3
Q. What does the code output? a = ["1","2","3"] a&.map(&:to_i)&.&([1])
Answer a = ["1","2","3"] a&.map(&:to_i)&.&([1]) # => [1]
Why?????
Answer a = ["1","2","3"] a&.map(&:to_i)&.&([1]) # => [1] &. is
a safe navigation op(nil guard). &:to_i is an implicit to_proc op. A safe navigation op & is an intersection op call (like [1,2,3] & [1])
Conclusion
• We can write tricky code in Ruby. ◦ Very
fun!!! Thank you for listening! Conclusion
More Decks by pocke
See All by pocke
New "Type" system on PicoRuby
pocke
2
2.1k
プログラミングで遊ぶ
pocke
0
190
Witchcraft for Memory
pocke
1
7k
The path to memory reduction in RBS
pocke
0
110
RBSのメモリ使用量改善への道
pocke
1
98
Community-driven RBS repository
pocke
2
1.8k
Active Record Query Quiz
pocke
1
1.7k
Let's write RBS!
pocke
1
5.6k
RBS and Rails, Present and Future
pocke
1
1.5k
Other Decks in Programming
See All in Programming
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
250
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
590
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
370
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
690
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
350
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
200
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
250
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
320
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
220
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
270
[Kotlin Fest 2026] eBPF Tracing for Kotlin
takehaya
1
330
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
110
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Done Done
chrislema
187
17k
The Art of Programming - Codeland 2020
erikaheidi
57
15k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
880
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
A Modern Web Designer's Workflow
chriscoyier
699
190k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
630
Leo the Paperboy
mayatellez
11
2.5k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
400
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
600
GitHub's CSS Performance
jonrohan
1033
470k