views:

80

answers:

1

I want to go through the children of an element and filter only the ones that are text or span, something like:

element.children.select {|child|
  child.class == String || child.element_type == 'span'
}

but I can't find a way to test which type a certain element is. How do I test that? I'd like to know that regardless if there's a better way of doing what I'm trying to do, but I also appreciate suggestions on that.

+1  A: 

Found it:

element.name
#=> "span"
obvio171