Sha256: 8020c1279700f6bb675f9bb4b58c6218678857672da9416c63ef68b72441b7d5

Contents?: true

Size: 376 Bytes

Versions: 1

Compression:

Stored size: 376 Bytes

Contents

# typed: strict
module Repeatable
  module Conversions
    extend T::Sig

    module_function

    sig { params(arg: Object).returns(::Date) }
    def Date(arg)
      case arg
      when Date, Time
        arg.to_date
      else
        Date.parse(arg)
      end
    rescue ArgumentError
      Kernel.raise TypeError, "Cannot convert #{arg.inspect} to Date"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
repeatable-1.1.0 lib/repeatable/conversions.rb