Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ruby Quiz
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
pocke
October 08, 2017
Programming
650
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby Quiz
at 学生エンジニア限定LT大会
pocke
October 08, 2017
More Decks by pocke
See All by pocke
New "Type" system on PicoRuby
pocke
2
2k
プログラミングで遊ぶ
pocke
0
160
Witchcraft for Memory
pocke
1
6.8k
The path to memory reduction in RBS
pocke
0
100
RBSのメモリ使用量改善への道
pocke
1
91
Community-driven RBS repository
pocke
2
1.7k
Active Record Query Quiz
pocke
1
1.7k
Let's write RBS!
pocke
1
5.5k
RBS and Rails, Present and Future
pocke
1
1.4k
Other Decks in Programming
See All in Programming
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
920
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
360
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
570
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
Heart of Swift Concurrency
koher
0
960
アクセシビリティから考える情報設計
high_g_engineer
0
400
Security issues being discussed on Web Platforms
petamoriken
0
1.2k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
350
すこし踏み込む CancellationToken
htkym
2
970
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
190
The Rails Doctrine Decade
koic
2
370
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
270
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
515
110k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
540
Visualization
eitanlees
153
17k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
260
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
66k
So, you think you're a good person
axbom
PRO
2
2.2k
Unsuck your backbone
ammeep
672
58k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
Git: the NoSQL Database
bkeepers
PRO
432
67k
The Limits of Empathy - UXLibs8
cassininazir
1
690
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