Permalink
Browse files

Module#class_variable_set raises a RuntimeError when self is frozen

  • Loading branch information...
1 parent 5a9984b commit fbe4193b0d29f0056d7b1dd60704597904237a13 @krekoten krekoten committed Oct 22, 2011
@@ -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 fbe4193

Please sign in to comment.