Skip to content

Commit

Permalink
Merge pull request rubinius#1331 from krekoten/core_module_class_vari…
Browse files Browse the repository at this point in the history
…able_set_19

Module#class_variable_set raises a RuntimeError when self is frozen
  • Loading branch information
davorb committed Oct 22, 2011
2 parents ae8f034 + fbe4193 commit 33ad0df
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kernel/common/module.rb
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions kernel/common/module18.rb
Expand Up @@ -25,4 +25,6 @@ def attr(name, writeable = false)
end

private :attr

alias_method :class_variable_set, :__class_variable_set__
end
5 changes: 5 additions & 0 deletions kernel/common/module19.rb
Expand Up @@ -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 change: 0 additions & 1 deletion spec/tags/19/ruby/core/module/class_variable_set_tags.txt

This file was deleted.

0 comments on commit 33ad0df

Please sign in to comment.