Skip to content
This repository has been archived by the owner on Jul 22, 2018. It is now read-only.

Extending Ruby with Ruby

benjaminoakes edited this page Apr 30, 2012 · 11 revisions

Presenter: Michael Fairley

Bio

Michael Fairley (@michaelfairley) is the lead developer at 1000memories, where he helps people preserve and cherish their most valuable memories. He’s an active open source contributor, and maintains a handful of side projects including mincemeat.py and bestintrobook.com.

Abstract

Other programming languages have powerful features that are often enviable while working in Ruby: Python’s function decorators, Scala’s partial evaluation, and Haskell’s lazy evaluation, among others. Fortunately, Ruby’s metaprogramming facilities give us the ability to add these features to Ruby ourselves, without the need for the core language to be changed.

This talk will walk through adding simple (yet functional) versions of the previously mentioned features to Ruby, using Ruby, and discuss the dos and don’ts of responsible Ruby metaprogramming.

Notes

method_decorators

Like function decorators (@memoize) in Python. Example from the README:

class Math
  extend MethodDecorators

  +Memoized
  def fib(n)
    if n <= 1
      1
    else
      fib(n - 1) * fib(n - 2)
    end
  end
end

External Links


Photo: John Parker (urgetopunt) (CC BY-NC-SA 2.0)

A crowd-sourced RailsConf wiki!
Working together is better. :)



Clone this wiki locally