From: eregontp@... Date: 2018-01-09T17:13:53+00:00 Subject: [ruby-core:84780] [Ruby trunk Feature#14344] refine at class level Issue #14344 has been updated by Eregon (Benoit Daloze). The whole purpose of the Module around it is so multiple refinements can be bundled up together in a Module and that Module is passed to #using. I don't think #refine should enable refinements after the block. It doesn't seem clear to me and is too confusing with the existing usage of #refine. Whether #refine is called on a Module or not would have very different semantics. Also I guess in general refinements are not defined right in the class using them, especially if they are not trivial one-liner methods. ---------------------------------------- Feature #14344: refine at class level https://bugs.ruby-lang.org/issues/14344#change-69496 * Author: kddeisz (Kevin Deisz) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- I rely on refinements a lot, but don't want to keep writing `Module.new` in code. I'm proposing `Object::refine`, which would create an anonymous module behind the scenes with equivalent functionality. So: ~~~ ruby class Test using Module.new { refine String do def refined? true end end } end ~~~ would become ~~~ ruby class Test refine String do def refined? true end end end ~~~ It's a small change, but reads a lot more clearly. Thoughts? -- https://bugs.ruby-lang.org/ Unsubscribe: