lib/data_model/fixtures/time.rb in data_model-0.4.0 vs lib/data_model/fixtures/time.rb in data_model-0.5.0
- old
+ new
@@ -1,24 +1,22 @@
-# typed: strict
-
module DataModel
+ # Test data around time schemas
module Fixtures::Time
- extend T::Sig
- extend self
include Fixtures
+ extend self
- sig { returns(::Time) }
+ # @return [Time] a time that is used by the #earliest example
def earliest_time
return ::Time.now - 1
end
- sig { returns(::Time) }
+ # @return [Time] a time that is used by the #latest example
def latest_time
return ::Time.now + 1
end
- sig { returns(T::Hash[Symbol, Object]) }
+ # @return [Hash{Symbol => untyped}] the variants used by each example
def variants
now = ::Time.now
{
time: now,
@@ -28,25 +26,29 @@
late: latest_time + 1,
missing: nil
}
end
- sig { returns(Example) }
+ # A simple time schema
+ # @return [Example] the example
def simple
Example.new([:time], variants:)
end
- sig { returns(Example) }
+ # A time schema that is optional
+ # @return [Example] the example
def optional
Example.new([:time, { optional: true }], variants:)
end
- sig { returns(Example) }
+ # A time schema that has a restriction on the earliest time
+ # @return [Example] the example
def earliest
Example.new([:time, { earliest: earliest_time }], variants:)
end
- sig { returns(Example) }
+ # A time schema that has a restriction on the latest time
+ # @return [Example] the example
def latest
Example.new([:time, { latest: latest_time }], variants:)
end
end
end