$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Whats up in Ruby 2.0
Search
Domas Bitvinskas
March 23, 2013
Programming
6
1.6k
Whats up in Ruby 2.0
A quick overview of the cool changes in Ruby 2.0 release.
Domas Bitvinskas
March 23, 2013
Tweet
Share
More Decks by Domas Bitvinskas
See All by Domas Bitvinskas
3 cool AI things
nedomas
0
490
Apollo & GraphQL: What we learned building a multi-platform chat app
nedomas
1
390
Best kept secrets for 2019: GraphQL + Prisma
nedomas
1
88
Tensorflow.js ir web ateitis
nedomas
1
180
Hack the Open Source Growth
nedomas
1
140
Market your Open Source or kill it
nedomas
1
1k
Ruby on Rails is dead
nedomas
2
1.2k
Why does Ruby own the startup world?
nedomas
0
690
Rockstars and Productivity
nedomas
1
990
Other Decks in Programming
See All in Programming
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
360
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
6
1.3k
ZOZOにおけるAI活用の現在 ~モバイルアプリ開発でのAI活用状況と事例~
zozotech
PRO
8
4k
connect-python: convenient protobuf RPC for Python
anuraaga
0
350
分散DBって何者なんだ... Spannerから学ぶRDBとの違い
iwashi623
0
170
ローターアクトEクラブ アメリカンナイト:川端 柚菜 氏(Japan O.K. ローターアクトEクラブ 会長):2720 Japan O.K. ロータリーEクラブ2025年12月1日卓話
2720japanoke
0
420
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
6.1k
俺流レスポンシブコーディング 2025
tak_dcxi
13
7.6k
Integrating WordPress and Symfony
alexandresalome
0
120
Evolving NEWT’s TypeScript Backend for the AI-Driven Era
xpromx
0
260
Building AI Agents with TypeScript #TSKaigiHokuriku
izumin5210
6
1.2k
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
540
Featured
See All Featured
How GitHub (no longer) Works
holman
316
140k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.2k
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
Automating Front-end Workflow
addyosmani
1371
200k
GitHub's CSS Performance
jonrohan
1032
470k
Code Review Best Practice
trishagee
73
19k
Balancing Empowerment & Direction
lara
5
780
Faster Mobile Websites
deanohume
310
31k
How to Think Like a Performance Engineer
csswizardry
28
2.3k
Unsuck your backbone
ammeep
671
58k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
370
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Transcript
RUBY 2.0 What u in DOMAS BITVINSKAS domasbitvinskas.com @Nedomas
20 27.days.ago ruby can almost play poke lega y
Syntax sparkle Evolved monkeys PERFORMANCE booooost PR “100 hundred procent
compatibl” - Matz
❤ = 'love' puts ❤ UTF-8 default encoding
class Integer def dalinasi_iš?(skaičius) skaičius != 0 ? self %
skaičius == 0 : zero? end end puts 6.dalinasi_iš?(2)
kwargs
# ruby 1.9 def shout(opts={}) loud = opts[:loud] || 'Hello'
quiet = opts[:quiet] || 'World' p "#{loud} #{quiet}!" end shout loud: "Old", quiet: "School" # ruby 2.0 def shout(loud: 'Hello', quiet: 'World') p "#{loud} #{quiet}!" end shout loud: "New", quiet: "School"
%i(an array of symbols) => [:an, :array, :of, :symbols] %I(#{100-50}
shades of grey) => [:"50", :shades, :of, :grey] PRO-TIP
module Logger def log(msg) p msg end end class Logic
include Logger def log(msg) p msg.reverse end end Module prepend
module Logger def log(msg) p msg end end class Logic
prepend Logger def log(msg) p msg.reverse end end Logic.new.log("Some message") # "Some message" Logic.ancestors # include => [Logic, Logger, Object, Kernel, BasicObject] # prepend => [Logger, Logic, Object, Kernel, BasicObject] Module prepend
ENUMERATORS even_numbers = (1..10000).select(&:even?).map(&:to_s) even_numbers = (1..10000).inject([]) do |acc, number|
if number.even? acc << number.to_s else acc end end for the lazy
ENUMERATORS even_numbers = (1..10000).lazy.select(&:even?).map(&:to_s) even_numbers = (1..10000).inject([]) do |acc, number|
if number.even? acc << number.to_s else acc end end for the lazy
REFINEMENTS experimental module Fun refine Fixnum do def +(_) super
- rand(3) end end end using Fun p 5 + 5
MAŽI GRAŽŪS DALYKAI
Drummer = Struct.new(:name, :age, :band) idol = Drummer.new("Carter Beauford", 55,
"Dave Matthews Band") p idol # => #<struct Drummer name="Carter Beauford", age=55, band="Dave Matthews Band"> p idol.to_h # => {:name=>"Carter Beauford", :age=>55, :band=>"Dave Matthews Band"} .to_h
ONIGMO REGEX VARIKLIS "this\nis\vMr.\rNeo".gsub(/\R/, ' ')
Array Range #bsearch p [1, 2, 3, 6, 9, 15].bsearch
{|i| i > 4 } p (1..10000000000000).bsearch {|i| i > 9 }
_ _di _ _
IMPROVE GARBAGE & STUFF! RubyGem 2.0 & RDoc 4.0
AČIŪ