Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some deprecated methods and modules #8646

Merged
merged 1 commit into from
Jan 5, 2020
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
5 changes: 0 additions & 5 deletions src/crypto/bcrypt/password.cr
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ class Crypto::Bcrypt::Password
Crypto::Subtle.constant_time_compare(@raw_hash, hashed_password)
end

@[Deprecated("Use `Crypto::Bcrypt::Password#verify`")]
def ==(password : String) : Bool
verify(password)
end

def to_s(io : IO) : Nil
io << @raw_hash
end
Expand Down
8 changes: 0 additions & 8 deletions src/http/server/response.cr
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,6 @@ class HTTP::Server
@output.closed?
end

# Sends an error response.
#
# Calls `#reset`, writes the given status, and closes the response.
@[Deprecated("Use #respond_with_status instead")]
def respond_with_error(message = "Internal Server Error", code = 500)
respond_with_status(code, message)
end

@status_message : String?

# Sends *status* and *message* as response.
Expand Down
25 changes: 0 additions & 25 deletions src/json/pull_parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@ class JSON::PullParser
BeginObject
EndObject
EOF

@[Deprecated("JSON::PullParser#kind now is an enum, please use that instead of symbols")]
def ==(other : Symbol)
case other
when :null then null?
when :bool then bool?
when :int then int?
when :float then float?
when :string then string?
when :begin_array then begin_array?
when :end_array then end_array?
when :begin_object then begin_object?
when :end_object then end_object?
when :EOF then eof?
else
false
end
end
end

private enum ObjectStackKind
Expand Down Expand Up @@ -563,10 +545,3 @@ class JSON::PullParser
@object_stack.push(kind)
end
end

struct Symbol
@[Deprecated("JSON::PullParser#kind now is an enum, please use that instead of symbols")]
def ==(other : JSON::PullParser::Kind)
other == self
end
end
34 changes: 0 additions & 34 deletions src/json/token.cr
Original file line number Diff line number Diff line change
Expand Up @@ -33,40 +33,6 @@ class JSON::Token
@raw_value = ""
end

@[Deprecated("Use JSON::Token#kind, which is an enum")]
def type : Symbol
case @kind
when .null?
:null
when .false?
:false
when .true?
:true
when .int?
:INT
when .float?
:FLOAT
when .string?
:STRING
when .begin_array?
:"["
when .end_array?
:"]"
when .begin_object?
:"{"
when .end_object?
:"}"
when .colon?
:":"
when .comma?
:","
when .eof?
:EOF
else
raise "Unknown token kind: #{@kind}"
end
end

def to_s(io : IO) : Nil
case @kind
when .null?
Expand Down
10 changes: 0 additions & 10 deletions src/string.cr
Original file line number Diff line number Diff line change
Expand Up @@ -844,16 +844,6 @@ class String
self[regex, group]?.not_nil!
end

@[Deprecated("Use `String#char_at` instead.")]
def at(index : Int)
char_at(index)
end

@[Deprecated("Use `String#char_at` instead.")]
def at(index : Int)
char_at(index) { yield }
end

def char_at(index : Int)
char_at(index) { raise IndexError.new }
end
Expand Down
24 changes: 0 additions & 24 deletions src/time.cr
Original file line number Diff line number Diff line change
Expand Up @@ -431,16 +431,6 @@ struct Time
new(seconds: seconds, nanoseconds: nanosecond.to_i, location: location)
end

@[Deprecated("Use `Time.local` instead.")]
def self.new(location : Location = Location.local) : Time
local(location)
end

@[Deprecated("Use `Time.local` instead.")]
def self.new(year : Int32, month : Int32, day : Int32, hour : Int32 = 0, minute : Int32 = 0, second : Int32 = 0, *, nanosecond : Int32 = 0, location : Location = Location.local) : Time
local(year, month, day, hour, minute, second, nanosecond: nanosecond, location: location)
end

# Creates a new `Time` instance representing the given date-time in UTC.
#
# ```
Expand Down Expand Up @@ -541,20 +531,6 @@ struct Time
utc(seconds: seconds, nanoseconds: nanoseconds.to_i)
end

# Creates a new `Time` instance representing the current time from the
# system clock observed in *location* (defaults to local time zone).
@[Deprecated("Use `Time.local` or `Time.utc` instead.")]
def self.now(location : Location = Location.local) : Time
local(location)
end

# Creates a new `Time` instance representing the current time from the
# system clock in UTC.
@[Deprecated("Use `Time.utc` instead.")]
def self.utc_now : Time
utc
end

# Creates a new `Time` instance with the same local date-time representation
# (wall clock) in a different *location*.
#
Expand Down
20 changes: 0 additions & 20 deletions src/uri/encoding.cr
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,6 @@ class URI
decode(string, io, plus_to_space: plus_to_space)
end

@[Deprecated("Use .decode or .decode_www_form instead")]
def self.unescape(string : String, io : IO, plus_to_space = false)
decode_www_form(string, io, plus_to_space: plus_to_space)
end

@[Deprecated("Use .decode or .decode_www_form instead")]
def self.unescape(string : String, plus_to_space = false)
decode_www_form(string, plus_to_space: plus_to_space)
end

# URL-encodes *string* as [`x-www-form-urlencoded`](https://url.spec.whatwg.org/#urlencoded-serializing).
#
# Reserved characters are escaped, unreserved characters are not.
Expand Down Expand Up @@ -165,16 +155,6 @@ class URI
end
end

@[Deprecated("Use .encode or .encode_www_form instead")]
def self.escape(string : String, io : IO, space_to_plus = false)
encode_www_form(string, io, space_to_plus: space_to_plus)
end

@[Deprecated("Use .encode or .encode_www_form instead")]
def self.escape(string : String, space_to_plus = false)
encode_www_form(string, space_to_plus: space_to_plus)
end

# Returns whether given byte is reserved character defined in
# [RFC 3986](https://tools.ietf.org/html/rfc3986).
#
Expand Down