lib/nanoc/helpers/link_to.rb in nanoc-4.1.1 vs lib/nanoc/helpers/link_to.rb in nanoc-4.1.2
- old
+ new
@@ -121,11 +121,11 @@
raise "Cannot get the relative path to #{target.inspect} because this target is not outputted (its routing rule returns nil)"
end
end
# Handle Windows network (UNC) paths
- if path.start_with?('//') || path.start_with?('\\\\')
+ if path.start_with?('//', '\\\\')
return path
end
# Get source and destination paths
dst_path = Pathname.new(path)
@@ -134,14 +134,15 @@
end
src_path = Pathname.new(@item_rep.path)
# Calculate the relative path (method depends on whether destination is
# a directory or not).
- if src_path.to_s[-1, 1] != '/'
- relative_path = dst_path.relative_path_from(src_path.dirname).to_s
- else
- relative_path = dst_path.relative_path_from(src_path).to_s
- end
+ relative_path =
+ if src_path.to_s[-1, 1] != '/'
+ dst_path.relative_path_from(src_path.dirname).to_s
+ else
+ dst_path.relative_path_from(src_path).to_s
+ end
# Add trailing slash if necessary
if dst_path.to_s[-1, 1] == '/'
relative_path << '/'
end