From: kevin.deisz@... Date: 2018-01-09T17:19:02+00:00 Subject: [ruby-core:84781] [Ruby trunk Feature#14344] refine at class level Issue #14344 has been updated by kddeisz (Kevin Deisz). I think we're talking about two different use cases. There is a place for refinements with large batch changes and a module is very appropriate for that. But for smaller refinements, which make life a lot easier, it's really not that far of a stretch. It's not that much different from `class Foobar ... end` being a shortcut for `Foobar = Class.new do ... end` ---------------------------------------- Feature #14344: refine at class level https://bugs.ruby-lang.org/issues/14344#change-69497 * 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: