mirror of
https://github.com/ruby/ruby.git
synced 2025-09-24 04:54:01 +02:00
envutil.rb: move labeled_module and labeled_class
* test/ruby/envutil.rb (labeled_module, labeled_class): move from test/ruby/test_module.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a2fb6e600c
commit
9a4185de25
2 changed files with 18 additions and 8 deletions
|
@ -1564,17 +1564,11 @@ class TestModule < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def labeled_module(name, &block)
|
||||
Module.new do
|
||||
singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s}
|
||||
class_eval(&block) if block
|
||||
end
|
||||
EnvUtil.labeled_module(name, &block)
|
||||
end
|
||||
|
||||
def labeled_class(name, superclass = Object, &block)
|
||||
Class.new(superclass) do
|
||||
singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s}
|
||||
class_eval(&block) if block
|
||||
end
|
||||
EnvUtil.labeled_class(name, superclass, &block)
|
||||
end
|
||||
|
||||
def test_prepend_instance_methods_false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue