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
630
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.3k
The path to memory reduction in RBS
pocke
0
69
RBSのメモリ使用量改善への道
pocke
1
73
Community-driven RBS repository
pocke
2
1.6k
Active Record Query Quiz
pocke
1
1.7k
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
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
460
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
「なんか〇〇ライブラリで脆弱性あるみたいなんだけど。。。」から始める脆弱性対応 / First Steps in Vulnerability Response
mackey0225
2
130
AIを導入する前にやるべきこと
negima
2
360
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
510
開発体験を左右するライブラリの API 設計 - GraphQL スキーマ構築ライブラリから考える #tskaigi
izumin5210
1
170
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
190
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
120
書き換えて学ぶTemporal #fukts
pirosikick
2
380
Sans tests, vos agents ne sont pas fiables
nabondance
0
130
Agentic AI & UI: Arcitecture, HITL, Emerging Standards
manfredsteyer
PRO
0
110
SkillsをS3 Filesに置く時のあれこれ
watany
3
1.6k
Featured
See All Featured
Designing Powerful Visuals for Engaging Learning
tmiket
1
370
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
260
Documentation Writing (for coders)
carmenintech
77
5.3k
Exploring anti-patterns in Rails
aemeredith
3
360
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
820
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
350
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.2k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
360
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
180
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
Designing for Performance
lara
611
70k
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