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
150
What is an API
jwo
0
220
DIY Rails Authentication
jwo
0
240
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
220
Other Decks in Technology
See All in Technology
AI駆動開発におけるQAエンジニアの役割事例 〜AI駆動開発の現場から〜
kobayashiyorimitsu
0
420
FinOps X 2026 Recap from Engineer Side #JapanFinOps
chacco38
0
270
最近評価が難しくなった
maroon8021
0
260
ポストモーテム! DDoSからサイトは守れた。 でもビジネスは守れなかった。
bengo4com
0
2.2k
【Claude Code】鹿野さんに聞く 私の推しの並行開発環境 大公開 / claude-code-parallel-2026-07-15
tonkotsuboy_com
5
940
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
1
4k
地域 SRE コミュニティ最前線 / SRE NEXT 2026 Discussion Night Track C
muziyoshiz
0
190
人を動かすのは時間ではなく、納得感 〜新任EMが入社3ヶ月、組織を2回変えた話〜
kakehashi
PRO
3
200
AIと共生する開発者プラットフォーム:バクラクのモノレポ×マイクロサービス基盤
sakajunquality
2
3k
NDIAS CTF 2026 問題解説会資料
bata_24
0
180
Foxgloveについて 実際にExtensionを開発して公開するまでの話 / About Foxglove: The Story of Developing and Releasing an Extension
ry0_ka
0
190
テスト設計の本質を改めて考えてみる~生成AIを活用する時代だからこそ、作ったテストの説明性を高めよう~
yamasaki696
1
410
Featured
See All Featured
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
170
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Accessibility Awareness
sabderemane
1
150
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
260
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.7k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
340
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
460
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
170
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
250
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!