File tree 4 files changed +10
-7
lines changed
4 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -358,17 +358,17 @@ def instance_method(name)
358
358
}
359
359
end
360
360
361
- def instance_methods ( include_super = false )
361
+ def instance_methods ( include_super = true )
362
362
%x{
363
363
var methods = [],
364
364
proto = self.$$proto;
365
365
366
366
for (var prop in proto) {
367
- if (!prop.charAt(0) === '$') {
367
+ if (!( prop.charAt(0) === '$') ) {
368
368
continue;
369
369
}
370
370
371
- if (typeof(proto[prop]) !== "function") {
371
+ if (!( typeof(proto[prop]) === "function") ) {
372
372
continue;
373
373
}
374
374
Original file line number Diff line number Diff line change 47
47
fails "Kernel#format is a private method"
48
48
fails "Kernel#sprintf is a private method"
49
49
fails "Kernel#warn is a private method"
50
+
51
+ fails "Module#instance_methods makes a private Object instance method public in Kernel"
50
52
end
Original file line number Diff line number Diff line change @@ -49,16 +49,16 @@ def some_bridged_method
49
49
50
50
describe ".instance_methdods" do
51
51
it "should report methods for class" do
52
- Array . instance_methods . should include ( :shift )
52
+ Array . instance_methods ( false ) . should include ( :shift )
53
53
end
54
54
55
55
it "should not include methods donated from Object/Kernel" do
56
- Array . instance_methods . should_not include ( :class )
56
+ Array . instance_methods ( false ) . should_not include ( :class )
57
57
end
58
58
59
59
it "should not include methods donated from BasicObject" do
60
- Array . instance_methods . should_not include ( :__send__ )
61
- Array . instance_methods . should_not include ( :send )
60
+ Array . instance_methods ( false ) . should_not include ( :__send__ )
61
+ Array . instance_methods ( false ) . should_not include ( :send )
62
62
end
63
63
end
64
64
end
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ corelib/core/module/class_variable_set_spec
82
82
corelib/core/module/module_function_spec
83
83
corelib/core/module/const_get_spec
84
84
corelib/core/module/include_spec
85
+ corelib/core/module/instance_methods_spec
85
86
86
87
corelib/core/range/begin_spec
87
88
corelib/core/range/case_compare_spec
You can’t perform that action at this time.
0 commit comments