Sha256: 0864c2c730afcfb12e9082454fca14e1dc23ed4e26cae31277dafb05c3d55f45

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

module Domainic
  module Type
    # A type for validating Date objects
    #
    # This type provides robust validation for `Date` objects, ensuring values conform
    # to specified chronological constraints. It supports the full range of date-based
    # constraints provided by `DateTimeBehavior`.
    #
    # Key features:
    # - Ensures the value is a `Date` object
    # - Supports validation for chronological relationships (e.g., before, after)
    # - Full integration with `DateTimeBehavior` for range and equality checks
    #
    # @example Basic usage
    #   type = DateType.new
    #   type.validate(Date.today)               # => true
    #   type.validate(DateTime.now)             # => false
    #
    # @example With range constraints
    #   type = DateType.new
    #     .being_between(Date.new(2024, 1, 1), Date.new(2024, 12, 31))
    #   type.validate(Date.new(2024, 6, 15))    # => true
    #   type.validate(Date.new(2023, 12, 31))   # => false
    #
    # @author {https://aaronmallen.me Aaron Allen}
    # @since 0.1.0
    class DateType
      extend Behavior::ClassMethods

      include Behavior

      include Behavior::DateTimeBehavior
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
domainic-type-0.1.0.alpha.3.4.1 sig/domainic/type/types/datetime/date_type.rbs
domainic-type-0.1.0.alpha.3.4.0 sig/domainic/type/types/datetime/date_type.rbs
domainic-type-0.1.0.alpha.3.3.0 sig/domainic/type/types/datetime/date_type.rbs
domainic-type-0.1.0.alpha.3.2.0 sig/domainic/type/types/datetime/date_type.rbs