1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-03-28 00:22:51 +01:00
parent 296f68816c
commit f234d51eab
50 changed files with 739 additions and 377 deletions

View file

@ -704,6 +704,17 @@ describe "Module#refine" do
-> { [1,2].orig_count }.should raise_error(NoMethodError)
end
it "and instance_methods returns a list of methods including those of the refined module" do
methods = Array.instance_methods
methods_2 = []
Module.new do
refine Array do
methods_2 = instance_methods
end
end
methods.should == methods_2
end
# Refinements are inherited by module inclusion.
# That is, using activates all refinements in the ancestors of the specified module.
# Refinements in a descendant have priority over refinements in an ancestor.