Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby Quiz
Search
pocke
October 08, 2017
Programming
1
610
Ruby Quiz
at 学生エンジニア限定LT大会
pocke
October 08, 2017
Tweet
Share
More Decks by pocke
See All by pocke
プログラミングで遊ぶ
pocke
0
81
Witchcraft for Memory
pocke
1
4.1k
The path to memory reduction in RBS
pocke
0
50
RBSのメモリ使用量改善への道
pocke
1
56
Community-driven RBS repository
pocke
2
1.5k
Active Record Query Quiz
pocke
1
1.6k
Let's write RBS!
pocke
1
5.2k
RBS and Rails, Present and Future
pocke
1
1.4k
The newsletter of RBS updates
pocke
1
3.5k
Other Decks in Programming
See All in Programming
関数実行の裏側では何が起きているのか?
minop1205
1
690
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
820
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
220
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
500
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
320
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.3k
AIコーディングエージェント(skywork)
kondai24
0
170
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
110
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.7k
TestingOsaka6_Ozono
o3
0
150
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
130
これならできる!個人開発のすゝめ
tinykitten
PRO
0
100
Featured
See All Featured
Optimizing for Happiness
mojombo
379
70k
Rails Girls Zürich Keynote
gr2m
95
14k
Scaling GitHub
holman
464
140k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
Music & Morning Musume
bryan
46
7k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.2k
Become a Pro
speakerdeck
PRO
31
5.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Transcript
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