Commit 6d7f3cbf authored by KitaitiMakoto's avatar KitaitiMakoto

Use rescue clause in begin-end block instead of directly under the method...

Use rescue clause in begin-end block instead of directly under the method definition fo Ruby 2.3 and 2.4
parent 3f648d35
Pipeline #34715159 failed with stages
in 47 seconds
......@@ -56,7 +56,11 @@ module EPUB
path_to_itemref = EPUB::CFI::Path.new([spine_step, itemref_step])
content_document = itemref.item.content_document
next unless content_document
doc = content_document.nokogiri
begin
doc = content_document.nokogiri
rescue LoadError
raise "#{self.class}##{__method__} requires Nokogiri gem for now. Install Nokogiri and then try again."
end
elems = if xpath
doc.xpath(xpath, namespaces)
else
......@@ -71,8 +75,6 @@ module EPUB
element: elem
}
end
rescue LoadError
raise "#{self.class}##{__method__} requires Nokogiri gem for now. Install Nokogiri and then try again."
end
results
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment