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
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
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
データ組織の転換期 一足飛びしない段階的戦略
leveragestech
PRO
0
150
TypeScript入門 2026
recruitengineers
PRO
1
330
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
[ChatGPT Work LT]事務作業が苦手な人のための バックオフィスの「半」自動化
chimaki_iot
0
200
Forza Horizon 6 のテレメトリ機能で 自動運転に使えそうな学習データを集める話
henjin0
0
130
SmartHR Engineering Team Deck
smarthr
0
190
メルカリのグローバルアプリで挑んだ AlloyDB 運用と課題解決の実践記
hatappi
0
230
侵入は突然に 〜 IoTマルウェアと悪用される家庭の機器 ~ / When Intrusion Strikes: IoT Malware and the Abuse of Home Devices
nttcom
0
1.5k
【Google Cloud Next Tokyo'26】Gemini Enterprise と Oracle AI Database で実現する、業務データ活用を実現する AI エージェント実装
shisyu_gaku
0
210
Software Supply Chain Attackからクラウド環境を守るためにできること
lhazy
2
130
トヨタ⽣産⽅式(TPS)⼊⾨
recruitengineers
PRO
1
460
変化の早いClaude Codeを 書籍に落とし込む
oikon48
6
1.3k
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
Abbi's Birthday
coloredviolet
3
9.2k
Technical Leadership for Architectural Decision Making
baasie
3
460
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
250
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
400
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Scaling GitHub
holman
464
140k
New Earth Scene 8
popppiees
3
2.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
GitHub's CSS Performance
jonrohan
1033
470k
Building Applications with DynamoDB
mza
96
7.2k
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!