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
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
370
Apollo & GraphQL: What we learned building a multi-platform chat app
nedomas
1
300
Best kept secrets for 2019: GraphQL + Prisma
nedomas
1
75
Tensorflow.js ir web ateitis
nedomas
1
160
Hack the Open Source Growth
nedomas
1
120
Market your Open Source or kill it
nedomas
1
950
Ruby on Rails is dead
nedomas
2
1.2k
Why does Ruby own the startup world?
nedomas
0
670
Rockstars and Productivity
nedomas
1
960
Other Decks in Programming
See All in Programming
複雑なフォームの jotai 設計 / Designing jotai(state) for Complex Forms #layerx_frontend
izumin5210
6
1.6k
20250429 - CNTUG Meetup #67 / DevOps Taiwan Meetup #69 - Deep Dive into Tetragon: Building Runtime Security and Observability with eBPF
tico88612
0
180
Cursor/Devin全社導入の理想と現実
saitoryc
29
22k
파급효과: From AI to Android Development
l2hyunwoo
0
170
最速Green Tea 🍵 Garbage Collector
kuro_kurorrr
1
130
VitestのIn-Source Testingが便利
taro28
9
2.5k
MySQL初心者が311個のカラムにNot NULL制約を追加していってALTER TABLEについて学んだ話
hatsu38
2
140
UMAPをざっくりと理解 / Overview of UMAP
kaityo256
PRO
3
1.6k
Browser and UI #2 HTML/ARIA
ken7253
2
180
Storybookの情報をMCPサーバー化する
shota_tech
3
1.2k
Flutterでllama.cppをつかってローカルLLMを試してみた
sakuraidayo
0
150
Duke on CRaC with Jakarta EE
ivargrimstad
1
140
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
105
19k
4 Signs Your Business is Dying
shpigford
183
22k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Designing for humans not robots
tammielis
253
25k
Building Applications with DynamoDB
mza
94
6.4k
GraphQLとの向き合い方2022年版
quramy
46
14k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Visualization
eitanlees
146
16k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Unsuck your backbone
ammeep
671
58k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
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Ū