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
Whats up in Ruby 2.0
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Domas Bitvinskas
March 23, 2013
Programming
1.6k
6
Share
Whats up in Ruby 2.0
A quick overview of the cool changes in Ruby 2.0 release.
Domas Bitvinskas
March 23, 2013
More Decks by Domas Bitvinskas
See All by Domas Bitvinskas
3 cool AI things
nedomas
0
540
Apollo & GraphQL: What we learned building a multi-platform chat app
nedomas
1
420
Best kept secrets for 2019: GraphQL + Prisma
nedomas
1
100
Tensorflow.js ir web ateitis
nedomas
1
200
Hack the Open Source Growth
nedomas
1
160
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
710
Rockstars and Productivity
nedomas
1
1k
Other Decks in Programming
See All in Programming
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
180
へんな働き方
yusukebe
6
2.9k
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
270
CDK Deployのための ”反響定位”
watany
0
500
Radical Imagining - LIFT 2025-2027 Policy Agenda
lift1998
0
250
「速くなった気がする」をデータで疑う
senleaf24
0
150
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
2
150
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
550
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
220
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
570
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
240
見せてもらおうか、 OpenSearchの性能とやらを!
shunta27
1
180
Featured
See All Featured
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
250
Google's AI Overviews - The New Search
badams
0
960
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
340
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
240
Embracing the Ebb and Flow
colly
88
5k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.3k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
250
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.7k
How GitHub (no longer) Works
holman
316
150k
Paper Plane (Part 1)
katiecoart
PRO
0
6.5k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
480
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
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Ū