Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby Trivia 2
Search
Erik Berlin
November 05, 2015
Programming
0
790
Ruby Trivia 2
Presented at the Berlin Ruby User Group (RUG::B) on November 5, 2015.
Erik Berlin
November 05, 2015
Tweet
Share
More Decks by Erik Berlin
See All by Erik Berlin
Enumerator::Lazy
sferik
2
600
Ruby Trivia 3
sferik
0
730
The Value of Being Lazy
sferik
3
830
Ruby Trivia
sferik
2
1.3k
💀 Symbols
sferik
5
1.9k
Content Negotiation for REST APIs
sferik
8
1k
Writing Fast Ruby
sferik
630
62k
Mutation Testing with Mutant
sferik
5
1.1k
Other Decks in Programming
See All in Programming
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
130
AIコーディングエージェント(Manus)
kondai24
0
200
認証・認可の基本を学ぼう後編
kouyuume
0
240
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
160
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
8
3.1k
ZOZOにおけるAI活用の現在 ~モバイルアプリ開発でのAI活用状況と事例~
zozotech
PRO
9
5.8k
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.4k
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
440
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
270
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
190
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.3k
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
530
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
160
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
0
91
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.1k
Statistics for Hackers
jakevdp
799
230k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
400
Information Architects: The Missing Link in Design Systems
soysaucechin
0
700
What does AI have to do with Human Rights?
axbom
PRO
0
1.9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
120
The SEO Collaboration Effect
kristinabergwall1
0
300
Transcript
Ruby Trivia 2
What is the return value of Ruby’s method visibility keywords?
private, public, protected Question 1:
self Answer 1: Ruby’s method visibility keywords can be used
as r-values.
Given a button method that takes an argument and a
block, which of these are valid Ruby? button "string" { |n| n } button "string" do |n| n end button ["string"] { |n| n } button ["string"] do |n| n end Question 2:
All except: button("string") { |n| n } Answer 2:
How could this line be fixed? button("string") { |n| n
} Bonus Question:
How could this line be fixed? button("string") { |n| n
} Bonus Question: Answer: Add parentheses around the argument.
What is the result of this line: a Hash with
a String key, a Hash with a Symbol key, or a SyntaxError? {"key": "What happens?"} Question 3:
a Hash with a Symbol key* Answer 3: *In Ruby
2.2 and later. In earlier versions, it raises a SyntaxError.
What is the value of each argument? def foo(*w, a:
7, **t) puts "w: #{w}, a: #{a}, t: #{t}" end foo({a: 1, b: 2, "c" => 3, d: 4}) Question 4:
w: [{"c" => 3}] a: 1 t: {:b => 2,
:d => 4} Answer 4:
What happens if you add a positional argument to the
end? def foo(*w, a: 7, **t) puts "w: #{w}, a: #{a}, t: #{t}" end foo({a: 1, b: 2, "c" => 3, d: 4}, 5) Bonus Question:
What happens if you add a positional argument to the
end? w: [{:a=>1, :b=>2, "c"=>3, :d=>4}, 5] a: 7 t: {} Bonus Question:
When you inspect Object.new, Ruby outputs something like: #<Object: 0x00c1a551f1ab1e>
What are the properties and significance of this hex number? Question 5:
1. It’s the object’s address in memory. 2. It’s always
even. 3. It’s double the object’s object_id. Answer 5:
Answer 5:
Thanks for playing! Follow @sferik on Twitter for more Ruby
trivia and practica.