5. Ruby’s History
0.95 Rails
arrives
on
the
scene.
Arguably
the
First
public
release start
of
Ruby’s
rise.
Feb 24 Dec 25 Aug
1993 1996 1.2 1999 1.6
Aug
2003
Dec
2007
Dec 21 Dec Sep Dec 13
1995 1998 1.4 2000 2005
I
want
a
language
more
powerful
than
Perl
and
Start
of
Xmas
Tradi.on Language
starts
gaining
Language
hits
the
big
more
OO
than
Python serious
trac.on .me.
1.0 1.8 1.9
6. Ruby’s History
Rails
arrives
on
the
scene.
Arguably
the
start
of
Ruby’s
rise.
Aug Dec
2003 2007
Dec 13
2.0
2005
nguage
starts
gaining
Feb 24
Start
of
Xmas
Tradi.on the
big
Language
hits
rious
trac.on .me.
2013
1.8 1.9
12. 1.9 GC
Heap based M&S
Ruby
structures
are
divided
in
2
halves,
data
and
flags.
Each
structure
has
its
own
flag.
Mark
phase
trawls
through
heap
and
updates
FL_MARK
flag
in
every
object
RString diagram from: http://patshaughnessy.net/2012/3/23/why-you-should-be-excited-about-garbage-collection-in-ruby-2-0
13. 2.0 GC
Bitmap marking
All
mark
flags
for
heap
move
to
single
dedicated
data
structure.
1
for
In
Use,
0
for
Collectable.
Flag
not
wriMen
to
data
structure,
much
more
friendly
to
copy-‐on-‐write
Heap diagram from: http://patshaughnessy.net/2012/3/23/why-you-should-be-excited-about-garbage-collection-in-ruby-2-0
26. Big Changes
Refinements
*
Localised
and
contained
monkey
patching
Module MyString
refine String do
def palindrome?
self == self.reverse
end
end
end
using MyString # Monkey patch now active for context
28. Little Changes
Literal
Symbol lists
sym_list = %i{eeny meeny miny moe}
# => [:eeny, :meeny, :miny, :moe]
29. Little Changes
Binary
Search
haystack = (1..99999999)
haystack.bsearch do |needle|
needle == 12345
end
# => 12345
30. Little Changes
UTF-8
On by Default
#!/usr/bin/env ruby1.9
#encoding: utf-8
puts “✖ ✹ ✚ ✭”
#!/usr/bin/env ruby-2.0
puts “✖ ✹ ✚ ✭”
31. Little Changes
__Dir__
keyword
Similar
in
func*onality
to
__FILE__
Shows
absolute
path
to
file’s
directory
No
more
clunky
File.dirname(__FILE__)
32. Little Changes
.to_h
Follows
conven*on
started
by
.to_s,
to_i,
to_a,
etc
Super
useful
for
conver*ng
Structs
33. Little Changes
Grab
Bag
CGI
is
now
HTML5
compa*ble
net/hLp
supports
Server
Name
Indica*on
(SNI)
Zlib
runs
outside
of
the
Global
Interpreter
Lock
Unused
variables
can
be
prepended
with
_
to
avoid
warnings
35. Ecosystem
RubyGems
2.0
Start
of
support
for
stdlib
gems
No
more
out
of
place
requires!
MOAR
BUNDLAR!
Searching
is
remote
by
default
Metadata
through
Gem::Specifica*on#metadata
Simplified
--document/--no-document
No
more
--no-rdoc --no-ri mantra
36. Ecosystem
Bundler
1.3(.1)
Supports
Ruby
2.0
Supports
Rubygems
2.0
Supports
Rails
4.0
install and update up
to
150x
faster
Support
for
signed
gems!
37. EcoSystem
Rails
4.0 beta
Ruby
2.0
is
the
official
preferred
ruby
version
Beta
released
1
day
a_er
Ruby
2.0
gem install rails --version 4.0.0.beta1 --no-document
gem ‘rails’, ‘4.0.0-beta1’