lib/iri.rb in iri-0.1.0 vs lib/iri.rb in iri-0.2.0

- old
+ new

@@ -73,33 +73,60 @@ params.delete(k.to_s) end end end + # Replace the query argument(s). def over(hash) modify_query do |params| hash.each do |k, v| params[k.to_s] = [] unless params[k] params[k.to_s] = [v] end end end + # Replace the scheme. def scheme(val) modify do |c| c.scheme = val end end + # Replace the host. def host(val) modify do |c| c.host = val end end + # Replace the port. def port(val) modify do |c| c.port = val + end + end + + # Replace the path part of the URI. + def path(val) + modify do |c| + c.path = val + end + end + + # Replace the query part of the URI. + def query(val) + modify do |c| + c.query = val + end + end + + # Remove the entire path+query+fragment part. + def cut(path = '/') + modify do |c| + c.query = nil + c.path = path + c.fragment = nil end end private