Reopening classes

class Fixnum
  def divisible_by? n
    self % n == 0
  end
end

4.divisible_by? 2 #=> true
4.divisible_by? 3 #=> false

Reopening classes

Monkey Patching

With great monkey power comes great monkey responsibility.

  - Spider Monkey

Lab: Array ExtensionsLab: In Words

<< Previous: Factories

Outline

[contents]

Reopening Classes Slides - Code Like This

/

#