Skip to content

Commit

Permalink
Adds: Module#public_constant can only be passed constant names define…
Browse files Browse the repository at this point in the history
…d in the target (self) module.

This commit makes the corresponding spec in
spec/ruby/core/module/public_constant_spec.rb pass.
The error message is the very as issued by MRI Ruby (1.9.3 head).
  • Loading branch information
troessner committed May 13, 2012
1 parent 15c5b3e commit 3f23ab2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions kernel/common/module19.rb
Expand Up @@ -148,5 +148,7 @@ def private_constant(*names)
end

def public_constant(*names)
unknown_constants = names - @constant_table.keys
raise NameError, "Constant #{name}::#{unknown_constants.first} not defined" if unknown_constants.size > 0
end
end
1 change: 0 additions & 1 deletion spec/tags/19/ruby/core/module/public_constant_tags.txt

This file was deleted.

0 comments on commit 3f23ab2

Please sign in to comment.