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
800
Writing Fast Ruby
sferik
619
59k
Mutation Testing with Mutant
sferik
5
980
Other Decks in Programming
See All in Programming
AppDeveloperCon 2024 EU: Building polyglot developer experiences in 2024
salaboy
0
370
クソコード動画『カプセル化 Mk-II』 で考える 上手くカプセル化できない理由 / encapsulation2
minodriven
11
7.7k
Parallel Socket Communication in Swift
s_shimotori
0
220
WinUI 3デモ - "CommunityToolkit.Mvvm"NuGetパッケージ編
andrewkeepcoding
0
130
CSRF対策のやり方、そろそろアップデートしませんか / Update your knowledge of CSRF protection
hiro_y
25
14k
Swiftの型推論を学ぼう | Let's Learn About Type Inference in Swift
omochi
2
510
Migrating to Signals: A Practical Workshop
manfredsteyer
PRO
0
280
Kotlinを用いたDSL的な設計手法と使用上の注意
kohii00
3
530
Dockerで始めるAWS Lambda開発
stutkhd0709
13
2.5k
自作ソフト(VMagicMirror)がVRMA対応してる話+実装のTips
bakudreameater
0
110
導入から5年が経って見えた Datadog APM 運用の課題
bgpat
2
540
ここ1~2年くらいで 使えるようになった(主要ブラウザーの最新版 がすべて対応した ) ウェブの新機能について ランダムに喋る!
myzkyy
9
6.4k
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.3k
The Cost Of JavaScript in 2023
addyosmani
13
3.7k
Building Flexible Design Systems
yeseniaperezcruz
317
37k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
14
1.3k
Reflections from 52 weeks, 52 projects
jeffersonlam
343
19k
It's Worth the Effort
3n
180
27k
What’s in a name? Adding method to the madness
productmarketing
PRO
14
2.6k
Facilitating Awesome Meetings
lara
39
5.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
67
38k
Web development in the modern age
philhawksworth
201
10k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
185
15k
Imperfection Machines: The Place of Print at Facebook
scottboms
257
12k
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.