Class: MandateClaw::DSL::TemporalConstraint
- Inherits:
-
Struct
- Object
- Struct
- MandateClaw::DSL::TemporalConstraint
- Defined in:
- lib/mandate_claw/dsl/temporal.rb
Overview
Represents a temporal constraint on an obligation or permission. Anchored to a named event or an absolute duration.
Used internally; surface API is:
obligation :pay, on: :buyer, within: 30.days
Instance Attribute Summary collapse
-
#anchor ⇒ Object
Returns the value of attribute anchor.
-
#duration ⇒ Object
Returns the value of attribute duration.
Instance Method Summary collapse
Instance Attribute Details
#anchor ⇒ Object
Returns the value of attribute anchor
11 12 13 |
# File 'lib/mandate_claw/dsl/temporal.rb', line 11 def anchor @anchor end |
#duration ⇒ Object
Returns the value of attribute duration
11 12 13 |
# File 'lib/mandate_claw/dsl/temporal.rb', line 11 def duration @duration end |
Instance Method Details
#breached?(base_time, now = Time.current) ⇒ Boolean
16 17 18 |
# File 'lib/mandate_claw/dsl/temporal.rb', line 16 def breached?(base_time, now = Time.current) now > deadline_from(base_time) end |
#deadline_from(base_time) ⇒ Object
12 13 14 |
# File 'lib/mandate_claw/dsl/temporal.rb', line 12 def deadline_from(base_time) base_time + duration end |