Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Module#class_variable_set raises a RuntimeError when self is frozen

  • Loading branch information...
commit fbe4193b0d29f0056d7b1dd60704597904237a13 1 parent 5a9984b
Мар'ян Крекотень (Marjan Krekoteń) krekoten authored
2  kernel/common/module.rb
@@ -47,7 +47,7 @@ def verify_class_variable_name(name)
47 47 end
48 48 private :verify_class_variable_name
49 49
50   - def class_variable_set(name, val)
  50 + def __class_variable_set__(name, val)
51 51 Rubinius.primitive :module_cvar_set
52 52
53 53 class_variable_set verify_class_variable_name(name), val
2  kernel/common/module18.rb
@@ -25,4 +25,6 @@ def attr(name, writeable = false)
25 25 end
26 26
27 27 private :attr
  28 +
  29 + alias_method :class_variable_set, :__class_variable_set__
28 30 end
5 kernel/common/module19.rb
@@ -40,4 +40,9 @@ def attr(*attributes)
40 40 end
41 41
42 42 private :attr
  43 +
  44 + def class_variable_set(key, value)
  45 + raise RuntimeError, "can't modify frozen #{self.class}" if frozen?
  46 + __class_variable_set__(key, value)
  47 + end
43 48 end
1  spec/tags/19/ruby/core/module/class_variable_set_tags.txt
... ... @@ -1 +0,0 @@
1   -fails:Module#class_variable_set raises a RuntimeError when self is frozen

0 comments on commit fbe4193

Please sign in to comment.
Something went wrong with that request. Please try again.