Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mime.cr
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module MIME
#
# A case-sensitive search is tried first, if this yields no result, it is
# matched case-insensitive. Returns *default* if *extension* is not registered.
def self.from_extension(extension : String, default) : String
def self.from_extension(extension : String, default : String) : String
from_extension(extension) { default }
end

Expand Down Expand Up @@ -182,7 +182,7 @@ module MIME
#
# A case-sensitive search is tried first, if this yields no result, it is
# matched case-insensitive. Returns *default* if extension is not registered.
def self.from_filename(filename : String | Path, default) : String
def self.from_filename(filename : String | Path, default : String) : String
from_extension(File.extname(filename.to_s), default)
end

Expand Down
6 changes: 3 additions & 3 deletions src/mime/media_type.cr
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module MIME
# mime_type["foo"] = "bar"
# mime_type["foo"] # => "bar"
# ```
def []=(key : String, value : String)
def []=(key : String, value : String) : String
raise Error.new("Invalid parameter name") unless MIME::MediaType.token? key
@params[key] = value
end
Expand Down Expand Up @@ -488,12 +488,12 @@ module MIME
end

# :nodoc:
def self.token?(string) : Bool
def self.token?(string : String) : Bool
string.each_char.all? { |char| token? char }
end

# :nodoc:
def self.quote_string(string, io) : Nil
def self.quote_string(string : String, io : IO) : Nil
string.each_char do |char|
case char
when '"', '\\'
Expand Down
2 changes: 1 addition & 1 deletion src/mime/multipart.cr
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module MIME::Multipart
#
# MIME::Multipart.parse_boundary("multipart/mixed; boundary=\"abcde\"") # => "abcde"
# ```
def self.parse_boundary(content_type) : String?
def self.parse_boundary(content_type : String) : String?
type = MIME::MediaType.parse?(content_type)

if type && type.type == "multipart"
Expand Down
2 changes: 1 addition & 1 deletion src/mime/multipart/builder.cr
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module MIME::Multipart
# builder = MIME::Multipart::Builder.new(io, "a4VF")
# builder.content_type("mixed") # => "multipart/mixed; boundary=a4VF"
# ```
def content_type(subtype = "mixed") : String
def content_type(subtype : String = "mixed") : String
MIME::MediaType.new("multipart/#{subtype}", {"boundary" => @boundary}).to_s
end

Expand Down