Actions
Feature #17022
closedAddition of method Kernel#Date
Status:
Third Party's Issue
Assignee:
-
Target version:
-
Description
What if we have a method Kernel#Date
that delegates to Date.parse
? Dates could be written in a more natural way, right?
Date("2020-01-13") - Date("2019-01-13")
Capitalized methods are defined on the Kernel
module to facilitate construction of basic types:
Kernel.methods.grep(/^[A-Z].*/)
#=> [:Rational, :Complex, :URI, :Integer, :Float, :String, :Array, :Hash, :Pathname]
Method BigDecimal
is added when the corresponding library is required:
require 'bigdecimal'
Kernel.methods.grep(/^[A-Z].*/)
#=> [:Rational, :Complex, :BigDecimal, :URI, :Integer, :Float, :String, :Array, :Hash, :Pathname]
The proposal is to do the same; when we do require 'date'
, a method Kernel#Date
should be added.
Actions
Like0
Like0Like0Like0