lib/weneedfeed/item.rb in weneedfeed-0.6.1 vs lib/weneedfeed/item.rb in weneedfeed-0.7.0
- old
+ new
@@ -46,11 +46,22 @@
# @return [String]
def link
::URI.join(
@url,
- @node.at(@link_selector)['href']
+ link_path_or_url
).to_s
+ end
+
+ # @return [Nokogiri::Node, nil]
+ def link_node
+ @node.at(@link_selector)
+ end
+
+ # @return [String, nil]
+ def link_path_or_url
+ node = link_node
+ node['href'] || node.inner_text
end
# @return [Time, nil]
def time
return unless @time_selector