lib/weneedfeed/item.rb in weneedfeed-0.10.0 vs lib/weneedfeed/item.rb in weneedfeed-0.11.0
- old
+ new
@@ -76,27 +76,35 @@
::URI.join(
@url,
image_path_or_url
).to_s
+ rescue ::URI::InvalidURIError
+ "#{@url}#{image_path_or_url}"
end
# @return [String]
def link
+ return unless link_path_or_url
+
::URI.join(
@url,
link_path_or_url
).to_s
+ rescue ::URI::InvalidURIError
+ "#{@url}#{link_path_or_url}"
end
# @return [Nokogiri::Node, nil]
def link_node
@node.at(@link_selector)
end
# @return [String, nil]
def link_path_or_url
node = link_node
+ return unless node
+
node['href'] || node.inner_text
end
# @return [Time, nil]
def time