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
620
1
Share
Ruby Quiz
at 学生エンジニア限定LT大会
pocke
October 08, 2017
More Decks by pocke
See All by pocke
プログラミングで遊ぶ
pocke
0
120
Witchcraft for Memory
pocke
1
6.1k
The path to memory reduction in RBS
pocke
0
62
RBSのメモリ使用量改善への道
pocke
1
72
Community-driven RBS repository
pocke
2
1.6k
Active Record Query Quiz
pocke
1
1.6k
Let's write RBS!
pocke
1
5.3k
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
Claude Codeをカスタムして自分だけのClaude Codeを作ろう
terisuke
0
130
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
910
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
460
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
130
Running Swift without an OS
kishikawakatsumi
0
830
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
290
第3木曜LT会 #28
tinykitten
PRO
0
100
KagglerがMixSeekを触ってみた
morim
0
380
10 Tips of AWS ~Gen AI on AWS~
licux
5
390
ハンズオンで学ぶクラウドネイティブ
tatsukiminami
0
130
PDI: Como Alavancar Sua Carreira e Seu Negócio
marcelgsantos
0
120
10年分の技術的負債、完済へ ― Claude Code主導のAI駆動開発でスポーツブルを丸ごとリプレイスした話
takuya_houshima
0
2.5k
Featured
See All Featured
Six Lessons from altMBA
skipperchong
29
4.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
320
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
The Language of Interfaces
destraynor
162
26k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
370
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
180
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
490
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