Permalink
Browse files

Merge pull request #1331 from krekoten/core_module_class_variable_set_19

Module#class_variable_set raises a RuntimeError when self is frozen
  • Loading branch information...
2 parents ae8f034 + fbe4193 commit 33ad0df16c26b54c5d5c7d55f51029f812ae629a @davorb davorb committed Oct 22, 2011
View
@@ -47,7 +47,7 @@ def verify_class_variable_name(name)
end
private :verify_class_variable_name
- def class_variable_set(name, val)
+ def __class_variable_set__(name, val)
Rubinius.primitive :module_cvar_set
class_variable_set verify_class_variable_name(name), val
@@ -25,4 +25,6 @@ def attr(name, writeable = false)
end
private :attr
+
+ alias_method :class_variable_set, :__class_variable_set__
end
@@ -40,4 +40,9 @@ def attr(*attributes)
end
private :attr
+
+ def class_variable_set(key, value)
+ raise RuntimeError, "can't modify frozen #{self.class}" if frozen?
+ __class_variable_set__(key, value)
+ end
end
@@ -1 +0,0 @@
-fails:Module#class_variable_set raises a RuntimeError when self is frozen

0 comments on commit 33ad0df

Please sign in to comment.