From: pablodherrero@... Date: 2016-08-08T15:59:50+00:00 Subject: [ruby-core:76769] [Ruby trunk Feature#9704] Refinements as files instead of modules Issue #9704 has been updated by Pablo Herrero. It would be interesting to apply a refinement to a whole app (without its gems) or inside a single gem without propagating to the rest of the app which loaded it. Although I'm not really sure about the best syntax to do it. ---------------------------------------- Feature #9704: Refinements as files instead of modules https://bugs.ruby-lang.org/issues/9704#change-59992 * Author: Thomas Sawyer * Status: Open * Priority: Normal * Assignee: Yukihiro Matsumoto ---------------------------------------- If refinements are to remain file-scoped, then it would be more convenient if `using` worked at the file level, akin to `require`, rather than behave like a module `include`. For instance, instead of: ~~~ # foo.rb module Foo refine String do def some_method ... end end end ~~~ ~~~ require 'foo' using Foo ~~~ We could do: ~~~ # foo.rb class String def some_method ... end end ~~~ ~~~ using 'foo' ~~~ This would make `require` and `using`, in a certain sense, *polymorphic* --if we `require` it will extend the classes directly, but if `using` then they will be refined instead. -- https://bugs.ruby-lang.org/ Unsubscribe: