Skip to content

Commit

Permalink
Add length limit option for methods that parses date strings
Browse files Browse the repository at this point in the history
`Date.parse` now raises an ArgumentError when a given date string is
longer than 128. You can configure the limit by giving `limit` keyword
arguments like `Date.parse(str, limit: 1000)`. If you pass `limit: nil`,
the limit is disabled.

Not only `Date.parse` but also the following methods are changed.

* Date._parse
* Date.parse
* DateTime.parse
* Date._iso8601
* Date.iso8601
* DateTime.iso8601
* Date._rfc3339
* Date.rfc3339
* DateTime.rfc3339
* Date._xmlschema
* Date.xmlschema
* DateTime.xmlschema
* Date._rfc2822
* Date.rfc2822
* DateTime.rfc2822
* Date._rfc822
* Date.rfc822
* DateTime.rfc822
* Date._jisx0301
* Date.jisx0301
* DateTime.jisx0301
  • Loading branch information
mame committed Nov 15, 2021
1 parent e0a4cbc commit 3959acc
Show file tree
Hide file tree
Showing 3 changed files with 326 additions and 89 deletions.
2 changes: 1 addition & 1 deletion date.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = "date"
s.version = '3.2.0'
s.version = '3.2.1'
s.summary = "A subclass of Object includes Comparable module for handling dates."
s.description = "A subclass of Object includes Comparable module for handling dates."

Expand Down
Loading

0 comments on commit 3959acc

Please sign in to comment.