Sha256: 608f6c254338270508f8c4c37ddeacbad166934b6e9920e4b7ef38b41ba0b0e5

Contents?: true

Size: 475 Bytes

Versions: 1

Compression:

Stored size: 475 Bytes

Contents

# typed: strict
# frozen_string_literal: true
require "pry"
module DearInventory
  module Validators
    class DateTime < DearInventory::Validator
      extend T::Sig

      sig { override.void }
      def call
        value = instance_variable_get(:@value)
        return if value.nil?
        return if value.respond_to?(:strftime)

        raise_error(
          "expected a DateTime but received the #{value.class} #{value.inspect}"
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dear_inventory-0.2.0 lib/dear_inventory/validators/time.rb