Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't assign nil to node attributes #38

Closed
neilconway opened this issue Feb 1, 2012 · 3 comments
Closed

Can't assign nil to node attributes #38

neilconway opened this issue Feb 1, 2012 · 3 comments

Comments

@neilconway
Copy link

require 'rubygems'
require 'graphviz'

# Create a new graph                                                                                                                                                                                        
g = GraphViz.new( :G, :type => :digraph )

# Create two nodes                                                                                                                                                                                          
hello = g.add_node( "Hello" )
hello.color = nil
world = g.add_node( "World" )

# Create an edge between the two nodes                                                                                                                                                                      
g.add_edge( hello, world )

# Generate output image                                                                                                                                                                                     
g.output( :png => "hello_world.png" )

With 0.9.21, this works; with 1.0.4, this raises an exception:

graphviz/attrs.rb:62:in `[]=': Invalide value `` for attribute `color` : undefined method `empty?' for nil:NilClass (AttributeException)

This breaks backward compatibility.

@glejeune
Copy link
Owner

glejeune commented Feb 2, 2012

Hum... Using "nil" as a color does not seems to be normal. But you are right, if this breaks backward compatibility, I have to do something.

My proposition :

If you passe nil as a value for an attribute, this attribute will be ignored and you'll receive a warning.

Is it ok for you ?

@ghost ghost assigned glejeune Feb 2, 2012
@neilconway
Copy link
Author

That would work. (Fixing my own code isn't hard to do, either -- I just thought I'd mention the issue as a possible backward compat concern.)

glejeune added a commit that referenced this issue Feb 6, 2012
@glejeune
Copy link
Owner

glejeune commented Feb 6, 2012

I made a correction. You can upgrade to 1.0.5. Thanks

@glejeune glejeune closed this as completed Feb 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants