Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save goyox86/480689 to your computer and use it in GitHub Desktop.
Save goyox86/480689 to your computer and use it in GitHub Desktop.
From 39899b7c48c272a6c049d2baf7411ed13eaed880 Mon Sep 17 00:00:00 2001
From: Jose Narvaez <[email protected]>
Date: Sun, 18 Jul 2010 16:03:12 -0430
Subject: [PATCH 2/2] Kernel.extend now raises a TypeError, when called on a frozen object
---
kernel/common/kernel.rb | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/kernel/common/kernel.rb b/kernel/common/kernel.rb
index fb897af..1471100 100644
--- a/kernel/common/kernel.rb
+++ b/kernel/common/kernel.rb
@@ -380,6 +380,8 @@ module Kernel
end
def extend(*modules)
+ Ruby.check_frozen
+
modules.reverse_each do |mod|
mod.__send__(:extend_object, self)
mod.__send__(:extended, self)
--
1.7.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment