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.5k
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
240
Apollo & GraphQL: What we learned building a multi-platform chat app
nedomas
1
230
Best kept secrets for 2019: GraphQL + Prisma
nedomas
1
73
Tensorflow.js ir web ateitis
nedomas
1
140
Hack the Open Source Growth
nedomas
1
94
Market your Open Source or kill it
nedomas
1
920
Ruby on Rails is dead
nedomas
2
1.2k
Why does Ruby own the startup world?
nedomas
0
660
Rockstars and Productivity
nedomas
1
960
Other Decks in Programming
See All in Programming
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
2.2k
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
770
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
170
rails newと同時に型を書く
aki19035vc
5
710
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
300
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
450
自分ひとりから始められる生産性向上の取り組み #でぃーぷらすオオサカ
irof
1
110
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
280
ecspresso, ecschedule, lambroll を PipeCDプラグインとして動かしてみた (プロトタイプ) / Running ecspresso, ecschedule, and lambroll as PipeCD Plugins (prototype)
tkikuc
2
1.9k
Azure AI Foundryのご紹介
qt_luigi
1
210
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
410
ESLintプラグインを使用してCDKのセオリーを適用する
yamanashi_ren01
2
240
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Done Done
chrislema
182
16k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
Unsuck your backbone
ammeep
669
57k
The Language of Interfaces
destraynor
155
24k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
Building an army of robots
kneath
302
45k
Agile that works and the tools we love
rasmusluckow
328
21k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
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Ū