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 Trivia
Search
Erik Berlin
October 01, 2015
Programming
2
1.1k
Ruby Trivia
Presented at the Berlin Ruby User Group (RUG::B) on October 1, 2015.
Erik Berlin
October 01, 2015
Tweet
Share
More Decks by Erik Berlin
See All by Erik Berlin
Enumerator::Lazy
sferik
1
370
Ruby Trivia 3
sferik
0
540
The Value of Being Lazy
sferik
3
570
Ruby Trivia 2
sferik
0
600
💀 Symbols
sferik
5
1.6k
Content Negotiation for REST APIs
sferik
8
810
Writing Fast Ruby
sferik
619
59k
Mutation Testing with Mutant
sferik
5
980
Other Decks in Programming
See All in Programming
とにかくHTTP3をライトニングに話す / Anyway, I'll talk to Lightning about HTTP3.
seike460
PRO
0
120
生成 AI の中身を覗いてみよう〜基礎から医療現場での応用まで〜
soh9834
2
770
CSRF対策のやり方、そろそろアップデートしませんか / Update your knowledge of CSRF protection
hiro_y
25
15k
SwiftUI, Jetpack Composeの導入で変化した「家族アルバム みてね」のアプリ開発体験
hicka04
6
400
Open Source Swift Workshop - Foundation and first party libraries
ikesyo
0
270
Swiftの型推論を学ぼう | Let's Learn About Type Inference in Swift
omochi
2
570
document.write再考
brn
5
2.5k
自動テスト実行結果の目的を整理する / Organizing objectives of automated test results
twada
PRO
10
2.1k
設計の知識と技能で駆動するソフトウェア開発
masuda220
PRO
18
11k
ドメイン・ファーストで考える問題解決に役立つモデル設計 / Domain First Model Design
suzushin54
1
1.4k
決断するための勇気、そのためのBacklog / Courage to make decisions, Backlog for that.
seike460
PRO
4
1.9k
Material 3で Material 2ぽい見た目にする
numeroanddev
2
250
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.4k
Designing on Purpose - Digital PM Summit 2013
jponch
109
6.4k
Web Components: a chance to create the future
zenorocha
304
41k
Fontdeck: Realign not Redesign
paulrobertlloyd
75
4.8k
Faster Mobile Websites
deanohume
296
30k
Why Our Code Smells
bkeepers
PRO
330
56k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.8k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
[RailsConf 2023] Rails as a piece of cake
palkan
21
3.8k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
1
3.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
242
20k
How To Stay Up To Date on Web Technology
chriscoyier
781
250k
Transcript
Ruby Trivia
In Ruby, a dash may not be used in a
variable name… …but before Ruby 2.1, one variable was allowed to be named with a dash. What was it called? Question 1:
In Ruby, a dash may not be used in a
variable name… …but before Ruby 2.1, one variable was allowed to be named with a dash. What was it called? Hint: It’s a global variable. Question 1:
$- Answer 1:
Why can’t variable names contain dashes? Bonus Question:
Why can’t variable names contain dashes? Bonus Question: Answer: Because
the Ruby parser can’t distinguish it from the minus (-) operator between two variables (e.g. forty-two).
Ruby may define a special File object in the first
file it interprets. What is it called? What does it do? Question 2:
Ruby may define a special File object in the first
file it interprets. What is it called? Question 2: Hint: When you call read, it reads the file, starting after __END__
DATA Answer 2:
What happens if you call: DATA.rewind before DATA.read Bonus Question:
What happens if you call: DATA.rewind before DATA.read Bonus Question:
Answer: It reads the entire file, including the source code.
The following line of code is valid Ruby syntax: a
= true && return But this line of code is not: a = return && true What is the error message? Question 3:
void value expression Answer 3:
When you convert the range: (1..3).to_a You get the array:
[1, 2, 3] What is the result of: (3..1).to_a Question 4:
[] Answer 4:
What method would need to be added to the Range
interface to make descending sequences possible? Bonus Question:
What method would need to be added to the Range
interface to make descending sequences possible? Bonus Question: Answer: pred (the opposite of succ).
What Ruby class mixes-in Comparable but doesn’t define the spaceship
(<=>) operator? Question 5:
What Ruby class mixes-in Comparable but doesn’t define the spaceship
(<=>) operator? Hint: It’s a descendant of Numeric. Question 5:
Complex Answer 5:
Thanks for playing! Follow @sferik on Twitter for more Ruby
trivia and practica.