Slide 1

Slide 1 text

ruby 2.0 San Diego Ruby - March 2013 - Matt Aimonetti Wednesday, March 13, 13

Slide 2

Slide 2 text

Barney Stinson approved Wednesday, March 13, 13

Slide 3

Slide 3 text

Safe for Human Consumption Wednesday, March 13, 13

Slide 4

Slide 4 text

horse meat free Wednesday, March 13, 13

Slide 5

Slide 5 text

Ruby is 20 years old! Wednesday, March 13, 13

Slide 6

Slide 6 text

what you really need to know Wednesday, March 13, 13

Slide 7

Slide 7 text

Migration from Ruby 1.9 is trivial Wednesday, March 13, 13

Slide 8

Slide 8 text

Ruby 1.8 reaches its end of life in June Wednesday, March 13, 13

Slide 9

Slide 9 text

Performance improvement Wednesday, March 13, 13

Slide 10

Slide 10 text

favorite Ruby Wednesday, March 13, 13

Slide 11

Slide 11 text

less new features Wednesday, March 13, 13

Slide 12

Slide 12 text

The new REE Wednesday, March 13, 13

Slide 13

Slide 13 text

Heroku support Wednesday, March 13, 13

Slide 14

Slide 14 text

Ruby 2.1 scheduled for Xmas 2013 Wednesday, March 13, 13

Slide 15

Slide 15 text

getting started Wednesday, March 13, 13

Slide 16

Slide 16 text

rvm rbenv chruby Wednesday, March 13, 13

Slide 17

Slide 17 text

libyaml (recent) openssl Dependencies you might need to resolve Wednesday, March 13, 13

Slide 18

Slide 18 text

new in 2.0 Wednesday, March 13, 13

Slide 19

Slide 19 text

default code encoding Wednesday, March 13, 13

Slide 20

Slide 20 text

keyword arguments Wednesday, March 13, 13

Slide 21

Slide 21 text

#  before def  create(name,  opts={})    opts[:tos]  ||=  false    opts[:timestamp]  ||=  Time.now end Wednesday, March 13, 13

Slide 22

Slide 22 text

#  now def  create(name,  tos:  false,                                    timestamp:  Time.now)    puts  [name,  tos,  timestamp].inspect end Wednesday, March 13, 13

Slide 23

Slide 23 text

create("Matt") #  -­‐>  ["Matt",  false,                2013-­‐03-­‐06  16:34:49  -­‐0800] create("Matt",  timestamp:  Time.now  -­‐  42) #  -­‐>  ["Matt",  false,                2013-­‐03-­‐06  16:34:07  -­‐0800] create("Matt",  tos:  true,  location:                                                                    "SDRuby") #  -­‐>  unknown  keyword:  location   (ArgumentError) Wednesday, March 13, 13

Slide 24

Slide 24 text

create("Matt",  tos:  true,  location:                                                                    "SDRuby") #  -­‐>  unknown  keyword:  location   (ArgumentError) Wednesday, March 13, 13

Slide 25

Slide 25 text

#  more  flexible  API   def  create(name,  tos:  false,                                    timestamp:  Time.now,                                    **rest)    puts  [name,  tos,  timestamp,                                                        rest].inspect end Wednesday, March 13, 13

Slide 26

Slide 26 text

create("Matt") #  -­‐>  ["Matt",  false,                      2013-­‐03-­‐06  16:30:29  -­‐0800,  {}] create("Matt",  timestamp:  Time.now  -­‐  42) #  -­‐>  ["Matt",  false,                      2013-­‐03-­‐06  16:29:47  -­‐0800,  {}] create("Matt",  tos:  true,                                location:  "SDRuby") #  -­‐>  ["Matt",  true,  2013-­‐03-­‐06  16:30:29   -­‐0800,  {:location=>"SDRuby"}] Wednesday, March 13, 13

Slide 27

Slide 27 text

#  required  keyword  param def  new(name,                    tos:  raise("TOS  is  required"),                  admin:  false) end Wednesday, March 13, 13

Slide 28

Slide 28 text

new("Matt",  tos:  false) #-­‐>  ["Matt",  false,  false] new("Matt") #-­‐>  TOS  is  required  (RuntimeError) Wednesday, March 13, 13

Slide 29

Slide 29 text

module #prepend Wednesday, March 13, 13

Slide 30

Slide 30 text

#  Not  our  code class  Action    def  start        "just  do  it"    end end Wednesday, March 13, 13

Slide 31

Slide 31 text

#  The  module  including  our   modifying  code module  RubyIt    def  start        super  +  "  better  with  Ruby!"    end end Wednesday, March 13, 13

Slide 32

Slide 32 text

module  RubyIt    def  start        super  +  "  better  with  Ruby!"    end end Wednesday, March 13, 13

Slide 33

Slide 33 text

class  Action    prepend  RubyIt end   p  Action.new.start #  -­‐>  "just  do  it  better  with  Ruby!" Wednesday, March 13, 13

Slide 34

Slide 34 text

lazy streams Wednesday, March 13, 13

Slide 35

Slide 35 text

require  'date'   #  Print  the  next  13  Friday  the  13th. puts  (Date.new(2013)..Date.new(9999))    .lazy    .select{|d|  d.day  ==  13  &&  d.friday?}    .first(13) Wednesday, March 13, 13

Slide 36

Slide 36 text

2013-09-13 2013-12-13 2014-06-13 2015-02-13 2015-03-13 2015-11-13 2016-05-13 2017-01-13 2017-10-13 2018-04-13 2018-07-13 2019-09-13 2019-12-13 Wednesday, March 13, 13

Slide 37

Slide 37 text

to_h convention Wednesday, March 13, 13

Slide 38

Slide 38 text

Talk  =  Struct.new(:title,  :speaker) Talk.new("Ruby  2.0",  "Matt").to_h #  =>  {:title=>"Ruby  2.0",              :speaker=>"Matt"}   Wednesday, March 13, 13

Slide 39

Slide 39 text

%i{foo  bar  baz} [:foo,  :bar,  :baz] Wednesday, March 13, 13

Slide 40

Slide 40 text

tracepoint support Wednesday, March 13, 13

Slide 41

Slide 41 text

GC/misc optimization Wednesday, March 13, 13

Slide 42

Slide 42 text

more... Wednesday, March 13, 13

Slide 43

Slide 43 text

caller_locations caller(start, length) Wednesday, March 13, 13

Slide 44

Slide 44 text

dtrace support Wednesday, March 13, 13

Slide 45

Slide 45 text

infamous refinements Wednesday, March 13, 13

Slide 46

Slide 46 text

Array / Range binary search Wednesday, March 13, 13

Slide 47

Slide 47 text

Kernel.inspect != Kernel.to_s Wednesday, March 13, 13

Slide 48

Slide 48 text

String#b "déjà  vu".b Wednesday, March 13, 13

Slide 49

Slide 49 text

Thread.        current.        thread_variable_set("@foo",  42) Thread. current. thread_variable_get("@foo") Thread.current.thread_variables Wednesday, March 13, 13

Slide 50

Slide 50 text

https://github.com/ruby/ ruby/blob/ruby_2_0_0/NEWS Wednesday, March 13, 13

Slide 51

Slide 51 text

@merbist http://matt.aimonetti.net Wednesday, March 13, 13