Skip to content

Commit

Permalink
Add return types to URI methods
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Jan 7, 2019
1 parent d43e2fa commit 8f1be0b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/uri.cr
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class URI
# uri = URI.parse "http://foo.com/posts?id=30&limit=5#time=1305298413"
# uri.full_path # => "/posts?id=30&limit=5"
# ```
def full_path
def full_path : String
String.build do |str|
str << (@path.empty? ? '/' : @path)
if (query = @query) && !query.empty?
Expand All @@ -135,12 +135,12 @@ class URI
end

# Returns `true` if URI has a *scheme* specified.
def absolute?
def absolute? : Bool
@scheme ? true : false
end

# Returns `true` if URI does not have a *scheme* specified.
def relative?
def relative? : Bool
!absolute?
end

Expand All @@ -152,7 +152,7 @@ class URI
!@scheme.nil? && @host.nil? && !@path.starts_with?('/')
end

def to_s(io : IO)
def to_s(io : IO) : Nil
if scheme
io << scheme
io << ':'
Expand Down Expand Up @@ -193,14 +193,14 @@ class URI
end

# Returns normalized URI.
def normalize
def normalize : self
uri = dup
uri.normalize!
uri

This comment has been minimized.

Copy link
@Sija

Sija Jan 7, 2019

Contributor
dup.tap(&.normalize!)
end

# Destructive normalize.
def normalize!
def normalize! : Nil

This comment has been minimized.

Copy link
@Sija

Sija Jan 7, 2019

Contributor

Please return self here.

@path = remove_dot_segments(path)
@port = nil if default_port?
end
Expand Down

0 comments on commit 8f1be0b

Please sign in to comment.