Method: Nokogiri::XML::Searchable#ancestors!
- Defined in:
- lib/ryoba/nokogiri/xml/searchable.rb
#ancestors!(selector = nil) ⇒ Nokogiri::XML::NodeSet
Like Searchable#ancestors, but raises an error if there are no matching ancestors.
76 77 78 79 80 81 82 |
# File 'lib/ryoba/nokogiri/xml/searchable.rb', line 76 def ancestors!(selector = nil) results = self.ancestors(selector) if results.empty? raise Ryoba::Error.new("No ancestors matching #{selector.inspect}") end results end |