lib/microformats/absolute_uri.rb in microformats-4.0.1 vs lib/microformats/absolute_uri.rb in microformats-4.0.2
- old
+ new
@@ -3,14 +3,15 @@
attr_accessor :base, :relative
def initialize(relative, base: nil)
@base = base
@relative = relative
- @base.strip! unless @base.nil?
- @relative.strip! unless @relative.nil?
+ @base = base.strip unless base.nil?
+ @relative = relative.strip unless relative.nil?
end
def absolutize
+ return relative if base.nil?
return base if relative.nil? or relative == ""
return relative if relative =~ /^https?:\/\//
return base + relative if relative =~ /^#/
uri = URI.parse(relative)