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
1.7k
The path to memory reduction in RBS
pocke
0
37
RBSのメモリ使用量改善への道
pocke
1
37
Community-driven RBS repository
pocke
2
1.3k
Active Record Query Quiz
pocke
1
1.4k
Let's write RBS!
pocke
1
4.9k
RBS and Rails, Present and Future
pocke
1
1.3k
The newsletter of RBS updates
pocke
1
3.4k
kwargs warning → Sentry
pocke
0
330
Other Decks in Programming
See All in Programming
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
1.1k
SQLアンチパターン第2版 データベースプログラミングで陥りがちな失敗とその対策 / Intro to SQL Antipatterns 2nd
twada
PRO
11
1.3k
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
2
1.1k
効率的な開発手段として VRTを活用する
ishkawa
0
160
코딩 에이전트 체크리스트: Claude Code ver.
nacyot
0
930
Porting a visionOS App to Android XR
akkeylab
0
680
The Niche of CDK Grant オブジェクトって何者?/the-niche-of-cdk-what-isgrant-object
hassaku63
1
610
[SRE NEXT] 複雑なシステムにおけるUser Journey SLOの導入
yakenji
0
150
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
870
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
170
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
180
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
620
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
21
1.3k
Navigating Team Friction
lara
187
15k
Gamification - CAS2011
davidbonilla
81
5.4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
235
140k
Statistics for Hackers
jakevdp
799
220k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
How to Think Like a Performance Engineer
csswizardry
25
1.7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
Making Projects Easy
brettharned
116
6.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
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