This is kind of a bummer. I have a gem that I'd like not to make =
dependent on some other arbitrary gem(s). (Yes, I know rubygems is a =
dependency manager.) In any case, to avoid pulling in all of =
ActiveSupport, I implement my own flavor of Inflector. And I put a few =
keen methods on String like String.singularize and String.pluralize...

All well and good until some other library with some other =
implementation of these String extensions gets pulled in.

So using what I thought refinements would be, I could have done:

module CoreExtensions
  class String
    def singularize
      # something here
    end
  end
end

class MyConsumerClass
  using CoreExtensions
 =20
  def do_something
    puts "dogs".singularize
  end
end

This would magically have scoped my String extensions to the =
CoreExtensions module, preventing any namespace pollution, while at the =
same time allowing include-like access to these extensions within my =
class.

File scope is ok, but nowhere near as precise as module or class scoped =
refinements.

Just my $.02.

On Jan 10, 2013, at 5:13 PM, Intransition <transfire / gmail.com> wrote:

> Refinements were altered (pretty much at the last moment) to be *file* =
scoped. So that's why `using` only makes sense at toplevel.
>=20