halostatue / color

Color tools for Ruby.
Other
133 stars 41 forks source link

Ignore inherited constants #24

Closed matthewd closed 9 years ago

matthewd commented 9 years ago

Before:

module ::Snow; end
require 'color'
!> ArgumentError: Snow already defined in Color::RGB

After:

module ::Snow; end
require 'color'
Color::RGB::Snow
=> RGB [#fffafa]
halostatue commented 9 years ago

For this to go into the current release, we need to make this version aware. This version of color still supports Ruby 1.8, which does not have the inherited parameter on .const_defined?.

matthewd commented 9 years ago

:sparkles:

halostatue commented 9 years ago

I will try to do a release in the next two weeks. I’m sorry I can’t do it sooner, but there’s some other work that I’m not sure of the status right now and I won’t have time to look at this before the weekend at earliest.

matthewd commented 9 years ago

No worries, thanks! :heart:

djberg96 commented 8 years ago

@halostatue Any chance of a new releases soon?

halostatue commented 8 years ago

I’ll try to get one out by the weekend. Work has been a bit crazy.

djberg96 commented 8 years ago

@halostatue Looking forward to it. With some of our stuff namespaced under "Azure" it is problematic at the moment.

halostatue commented 8 years ago

I’m changing this to:

    used = names - mod.constants.map(&:to_sym)
    if used.length < names.length

It has the advantage of not requiring different implementations for Ruby 1.8 and Ruby 1.9 and it implicitly limits lookup to the directly owned constants of mod (e.g., Color::RGB).

halostatue commented 8 years ago

@djberg96 @matthewd I have release color 1.8 with the variant fix I put in place.