Using a Refinement!
module Permalinker!
refine String do!
def permalinkify!
downcase.split.join("-")!
end!
end!
end!
!
class Post!
using Permalinker!
!
def initialize(title)!
@title = title!
end!
!
def permalink!
->@title.permalinkify!
end!
end!
Slide 30
Slide 30 text
Required
Keyword ArGS
Slide 31
Slide 31 text
Required Keyword Args!
def permalinkfiy(str, delimiter: "-")!
str.downcase.split.join(delimiter)!
end!
< Ruby 2.1
Question: How do we make str
required?!
Generational GC!
Key Idea:!
!
Objects that are most
recently created often
die young.!
Slide 40
Slide 40 text
Generational GC!
• split objects into young
and old based on whether
they survive a garbage
collection run.!
• concentrate on freeing up
memory on the young
generation.!
Slide 41
Slide 41 text
Why "Restricted"?!
• still using Mark and Sweep
to garbage collect young/
old generations!
• preserve compatibility with
C extensions!