# Colour bug?

**URL:** <https://www.ruby-forum.com/t/colour-bug/159133>\
**Category:** wxRuby\
**Created:** [February 1, 2009, 3:04am UTC](https://www.ruby-forum.com/t/colour-bug/159133 "2009-02-01T03:04:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmcghee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rmcghee](https://www.ruby-forum.com/u/rmcghee)\
**Post date:** [February 1, 2009, 3:04am UTC](https://www.ruby-forum.com/t/colour-bug/159133/1 "2009-02-01T03:04:58Z")

</div>

Here is some code to demonstrate that  
“==” doesn’t seem to work completely for colour.

The only problem I’ve noticed is when testing  
against nil.

#---------------------------------------------------  
require ‘wx’  
include Wx

class Demo  
def try(arg)  
if (arg == nil)  
result = “Nil”  
elsif (arg.is\_a?(Array))  
result = “Array”  
elsif (arg.is\_a?(Colour))  
result = “Colour”  
elsif (arg.is\_a?(String))  
result = “String”  
else  
result = “Unclassified”  
end

puts result  
end  
end

bd = Demo.new

n = nil  
bd.try(n)

array = %w(one two)  
bd.try(array)

string = “abc”  
bd.try(string)

colour = Colour.new(0, 0, 0, 255)  
bd.try(colour)

An interesting work-around is to put the  
Colour test _first_. However, it sure  
would be nice if Colour worked like the  
other objects.

Ridge

---

<div class="post-metadata">

**Author:** ![rmcghee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rmcghee](https://www.ruby-forum.com/u/rmcghee)\
**Post date:** [February 1, 2009, 4:35am UTC](https://www.ruby-forum.com/t/colour-bug/159133/2 "2009-02-01T04:35:28Z")

</div>

Hi

Ridge M. wrote:

> class Demo  
> result = “Unclassified”
> 
> An interesting work-around is to put the  
> Colour test _first_. However, it sure  
> would be nice if Colour worked like the  
> other objects.

Thanks for the report. wxRuby shouldn’t be so stern. It’s fixed by  
SVN:1990

[http://rubyforge.org/pipermail/wxruby-svn-commit/2009-January/000846.html](http://rubyforge.org/pipermail/wxruby-svn-commit/2009-January/000846.html)

a
