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
Ruby 2.1 Overview
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Jesse Wolgamott
January 15, 2014
Technology
1.1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby 2.1 Overview
(For HoustonRB)
Jesse Wolgamott
January 15, 2014
More Decks by Jesse Wolgamott
See All by Jesse Wolgamott
React vs React-Native
jwo
0
160
What is an API
jwo
0
230
DIY Rails Authentication
jwo
0
250
ActionCable - For Not Another Chat App
jwo
3
1.8k
SlackBot.rb - Create You a Slack Bot
jwo
1
1.5k
react-rails: an isomorphic match made in heaven
jwo
0
1.4k
Docker - next big thing
jwo
0
1k
Rails 4: Appetizers
jwo
1
1.1k
The Long Ball: Upgrading Rails from 1.2 -> 4.0
jwo
2
230
Other Decks in Technology
See All in Technology
Eight Engineering Unit 紹介資料
sansan33
PRO
3
8.3k
型落ちシンクライアント端末のPoEモジュールを自作したかった話
logica0419
0
480
Master Dataグループ紹介資料
sansan33
PRO
1
4.8k
サイボウズ 開発本部採用ピッチ / Cybozu Engineer Recruit
cybozuinsideout
PRO
12
86k
AI駆動開発をチームに根付かせる - 「1行も書かない」チームがHarnessを育てた1年 -
kenichirokimura
3
2.6k
フィジカルAIの知識ゼロの僕でも AIを使えばここまでできた
tatsuya1970
0
190
AWSとAzureのマルチクラウド活用における強い味方___AWS_Kiroを使った二刀流スキル作成.pdf
duelist2020jp
0
120
AIレビュー時代に必要なのは、SLOで引く撤退ライン
nobuoooo
0
140
Bill One 開発エンジニア 紹介資料
sansan33
PRO
7
20k
500名弱規模の組織のPythonプロジェクト(dbt) をどう管理するか?
hiracky16
0
300
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
5k
どんな手を使っても絶対間に合わせるスケジューラ
asari194617
0
1.5k
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
450
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
300
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
From π to Pie charts
rasagy
0
330
Practical Orchestrator
shlominoach
191
12k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
250
Statistics for Hackers
jakevdp
799
230k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Transcript
@jwo Ruby 2.1
@jwo `def` returns a method
@jwo module Foo! def public_method! end! ! def some_other_method! end!
! private :some_other_method! ! private! def a_private_method! end! end! ! Foo.private_instance_methods! => [:some_other_method, :a_private_method]
@jwo module Foo! def public_method! end! ! private def some_other_method!
end! ! private def a_private_method! end! end! ! Foo.private_instance_methods! => [:some_other_method, :a_private_method]
@jwo Refinements Launched and the world did not end.
@jwo module Permalinker! refine String do! def permalinkify! downcase.split.join("-")! end!
end! end
@jwo class Post! using Permalinker! ! def initialize(title)! @title =
title! end! ! def permalink! @title.permalinkify! end! end
@jwo "Refinements are not globally scoped".permalinkify! ! ! ! NoMethodError:
undefined method `permalinkify' for "Refinements are not globally scoped":String
@jwo Restricted Keyword Args
@jwo def order_tacos(type: 5, how_many: 'queso')! puts "Ordering #{how_many} #{type}"!
end! ! order_tacos type: "fajita_queso", how_many: 5 in Ruby 2.0, you HAD to specify a default for type and how_many
@jwo def order_tacos(type:, how_many:)! puts "Ordering #{how_many} #{type}"! end! !
order_tacos type: "fajita_queso", how_many: 5! order_tacos type: “fajita_queso"! ! => ArgumentError: missing keyword: how_many NO LONGER
@jwo Restricted Generational Garbage Collector (RGENGC)
@jwo ummm wat
@jwo Ruby 1.8: Mark and Sweep http://tmm1.net/ruby21-rgengc/
@jwo Ruby 1.9.3 “Lazy Sweep” http://tmm1.net/ruby21-rgengc/
@jwo Ruby 2.0 bitmaps for copy-on-write safety http://tmm1.net/ruby21-rgengc/
@jwo Ruby 2.1: OldGen and minor marking http://tmm1.net/ruby21-rgengc/
@jwo Some Graphs!
@jwo Some Little Stuff
@jwo 27r # => Rational(27/1)! 1/2r # => Rational(1/2)! 12+33i
# => Complex(12,33) Decimal Literal Syntax
@jwo 3.times{puts'blah'.object_id}! # => 70287241728160! # => 70287241728080! # =>
70287241728020! ! 3.times{puts'blah'f.object_id}! # => 70287241709760 ! # => 70287241709760! # => 70287241709760 Frozen String Literal (Same)
@jwo $ stackprof data/stackprof-cpu-4120-1384979644.dump --text --limit 4 ================================== Mode: cpu(1000)
Samples: 9145 (1.25% miss rate) GC: 448 (4.90%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 236 (2.6%) 231 (2.5%) String#blank? 546 (6.0%) 216 (2.4%) ActiveRecord::ConnectionAdapters::Mysql2Adapter#select 212 (2.3%) 199 (2.2%) Mysql2::Client#query_with_timing ! $ stackprof data/stackprof-cpu-4120-1384979644.dump --method 'String#blank?' String#blank? (lib/active_support/core_ext/object/blank.rb:80) samples: 231 self (2.5%) / 236 total (2.6%) callers: 112 ( 47.5%) Object#present? code: | 80 | def blank? 187 (2.0%) / 187 (2.0%) | 81 | self !~ /[^[:space:]]/ Profiling Tools (rb_profile_frames)
@jwo Install today!