Skip to content

Commit

Permalink
addressable: Add Addressable::URI#omit
Browse files Browse the repository at this point in the history
Addressable::URI#omit allows for returning a new instance of
Addressable::URI with the specified components omitted.

https://github.com/sporkmonger/addressable/blob/4229164843616783287ca359bbe38b574f1908a3/lib/addressable/uri.rb#L2285-L2314
  • Loading branch information
rossta committed Nov 19, 2024
1 parent 5fcf7d4 commit 260e31c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gems/addressable/2.8/_test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
# "fragment" => "foo"
# }

uri = Addressable::URI.parse(
"http://example.com/a/b/c"
)
uri = Addressable::URI.parse("http://example.com/a/b/c")
uri.query_values # => nil
uri.query_values = {"one" => "1", "two" => "2"}
uri.query_values # => {"one" => "1", "two" => "2"}
Expand All @@ -62,3 +60,7 @@
uri.query_values # => {"seven"=>"7", "andup"=>"10"}
uri.query_values = nil
uri.query_values # => nil


uri = Addressable::URI.parse("http://example.com?a=b&c=d")
uri.omit(:query).to_s # => "http://example.com"
1 change: 1 addition & 0 deletions gems/addressable/2.8/addressable.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module Addressable
def domain: () -> String
def authority: () -> String
def authority=: (String new_authority) -> String
def omit: (*Symbol components) -> URI
def origin: () -> String
def origin=: (String new_origin) -> String
attr_reader port: Integer
Expand Down

0 comments on commit 260e31c

Please sign in to comment.