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

nodes named "description" are not accessible through Slop #330

Closed
ghazel opened this issue Aug 19, 2010 · 2 comments
Closed

nodes named "description" are not accessible through Slop #330

ghazel opened this issue Aug 19, 2010 · 2 comments

Comments

@ghazel
Copy link

ghazel commented Aug 19, 2010

doc = Nokogiri::Slop("<item><title>foo</title><description>this is the foo thing</description></item>")
p "doc.item.title:", doc.item.title
p "doc.item.description:", doc.item.description

Prints:

"doc.item.title:"
#<Nokogiri::XML::Element:0x243ba0a name="title" children=[#<Nokogiri::XML::Text:0x243b8ac "foo">]>
"doc.item.description:"
nil
@tenderlove
Copy link
Member

Hi! Unfortunately, we can't fix this. The reason is because Nokogiri::XML::Node responds to "description". With HTML documents, "description" returns a description of the node, where on XML documents, it returns nil.

I've added a hack for the slop visitor that lets you use an underscore if the method is already defined. So you can do this:

doc.item._description

Hope that helps!

@tenderlove
Copy link
Member

adding a hack for the slop decorator. closed by d9f41bf

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants