Method: Nokogiri::XML::Searchable#search!
- Defined in:
- lib/ryoba/nokogiri/xml/searchable.rb
#search!(*queries) ⇒ Nokogiri::XML::NodeSet
Like Searchable#search, but raises an error if there are no results.
21 22 23 24 25 26 27 |
# File 'lib/ryoba/nokogiri/xml/searchable.rb', line 21 def search!(*queries) results = self.search(*queries) if results.empty? raise Ryoba::Error.new("No elements matching #{queries.map(&:inspect).join(" OR ")}") end results end |