Method: Hanami::Utils::Kernel.Date
- Defined in:
- lib/hanami/utils/kernel.rb
permalink .Date(arg) ⇒ Date
Coerces the argument to be a Date.
716 717 718 719 720 721 722 723 724 |
# File 'lib/hanami/utils/kernel.rb', line 716 def self.Date(arg) if arg.respond_to?(:to_date) arg.to_date else Date.parse(arg.to_s) end rescue ArgumentError, NoMethodError raise TypeError.new "can't convert #{inspect_type_error(arg)}into Date" end |