Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Module#class_variable_set raises a RuntimeError when self is frozen #1331

Merged
merged 1 commit into from

2 participants

Мар'ян Крекотень (Marjan Krekoteń) Davor Babić
Мар'ян Крекотень (Marjan Krekoteń)
Collaborator

No description provided.

Davor Babić davorb merged commit 33ad0df into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  kernel/common/module.rb
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
2  kernel/common/module18.rb
View
@@ -25,4 +25,6 @@ def attr(name, writeable = false)
end
private :attr
+
+ alias_method :class_variable_set, :__class_variable_set__
end
5 kernel/common/module19.rb
View
@@ -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  spec/tags/19/ruby/core/module/class_variable_set_tags.txt
View
@@ -1 +0,0 @@
-fails:Module#class_variable_set raises a RuntimeError when self is frozen
Something went wrong with that request. Please try again.