Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Do not load classes with prepend in ruby < 1.9.3

  • Loading branch information...
commit 49e09d897f423e966f556e4e17d7c7bd8f36a1b8 1 parent 648a7e8
@LTe LTe authored
Showing with 40 additions and 38 deletions.
  1. +40 −38 spec/ruby/core/module/fixtures/classes.rb
View
78 spec/ruby/core/module/fixtures/classes.rb
@@ -381,48 +381,50 @@ def extend_object(obj)
end
end
- module PrependModules
- module M0
- def m1; [:M0] end
- end
- module M1
- def m1; [:M1, *super] end
- end
- module M2
- def m1; [:M2, *super] end
- end
- M3 = Module.new do
- def m1; [:M3, *super] end
- end
- module M4
- def m1; [:M4, *super] end
- end
- class C
- def m1; end
- end
- class C0 < C
- include M0
- prepend M1
- def m1; [:C0, *super] end
- end
- class C1 < C0
- prepend M2, M3
- include M4
- def m1; [:C1, *super] end
+ if RUBY_VERSION > "1.9.3"
+ module PrependModules
+ module M0
+ def m1; [:M0] end
+ end
+ module M1
+ def m1; [:M1, *super] end
+ end
+ module M2
+ def m1; [:M2, *super] end
+ end
+ M3 = Module.new do
+ def m1; [:M3, *super] end
+ end
+ module M4
+ def m1; [:M4, *super] end
+ end
+ class C
+ def m1; end
+ end
+ class C0 < C
+ include M0
+ prepend M1
+ def m1; [:C0, *super] end
+ end
+ class C1 < C0
+ prepend M2, M3
+ include M4
+ def m1; [:C1, *super] end
+ end
end
- end
- module ModuleToPrepend
- def m
- result = super
- [:m, result]
+ module ModuleToPrepend
+ def m
+ result = super
+ [:m, result]
+ end
end
- end
- class ClassToPrepend
- prepend ModuleToPrepend
- def m
- :c
+ class ClassToPrepend
+ prepend ModuleToPrepend
+ def m
+ :c
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.