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 Quiz
Search
pocke
October 08, 2017
Programming
1
590
Ruby Quiz
at 学生エンジニア限定LT大会
pocke
October 08, 2017
Tweet
Share
More Decks by pocke
See All by pocke
Witchcraft for Memory
pocke
1
3k
The path to memory reduction in RBS
pocke
0
42
RBSのメモリ使用量改善への道
pocke
1
43
Community-driven RBS repository
pocke
2
1.3k
Active Record Query Quiz
pocke
1
1.4k
Let's write RBS!
pocke
1
5k
RBS and Rails, Present and Future
pocke
1
1.4k
The newsletter of RBS updates
pocke
1
3.4k
kwargs warning → Sentry
pocke
0
340
Other Decks in Programming
See All in Programming
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.2k
プロパティベーステストによるUIテスト: LLMによるプロパティ定義生成でエッジケースを捉える
tetta_pdnt
0
270
時間軸から考えるTerraformを使う理由と留意点
fufuhu
14
4.6k
Deep Dive into Kotlin Flow
jmatsu
1
240
Updates on MLS on Ruby (and maybe more)
sylph01
1
180
Amazon RDS 向けに提供されている MCP Server と仕組みを調べてみた/jawsug-okayama-2025-aurora-mcp
takahashiikki
1
110
ユーザーも開発者も悩ませない TV アプリ開発 ~Compose の内部実装から学ぶフォーカス制御~
taked137
0
110
Laravel Boost 超入門
fire_arlo
2
210
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
820
Navigating Dependency Injection with Metro
zacsweers
2
190
ソフトウェアテスト徹底指南書の紹介
goyoki
1
150
アセットのコンパイルについて
ojun9
0
120
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
111
20k
Music & Morning Musume
bryan
46
6.8k
We Have a Design System, Now What?
morganepeng
53
7.8k
How to Ace a Technical Interview
jacobian
279
23k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Speed Design
sergeychernyshev
32
1.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Unsuck your backbone
ammeep
671
58k
Building Applications with DynamoDB
mza
96
6.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
187
55k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
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