lib/iri.rb in iri-0.3.0 vs lib/iri.rb in iri-0.4.0

- old
+ new

@@ -159,9 +159,20 @@ c.path = path c.fragment = nil end end + # Append something new to the path: + # + # Iri.new('https://google.com/a/b?q=test').append('/hello') + # + # The result will contain "https://google.com/a/b/hello?q=test". + def append(part) + modify do |c| + c.path = c.path + '/' + CGI.escape(part) + end + end + private def modify c = @uri.clone yield c