Class: Mon::Contract::Future

Inherits:
MonadContract
  • Object
show all
Defined in:
lib/contracts/future.rb

Instance Method Summary collapse

Methods inherited from MonadContract

#initialize, #nested_contract, #to_s, #valid_nested_contract?

Constructor Details

This class inherits a constructor from Mon::Contract::MonadContract

Instance Method Details

#valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
24
25
# File 'lib/contracts/future.rb', line 20

def valid?(val)
  # Should be a Future, and if finalized it should satisfy
  # the provided contract. Note: We can't know if an inflight
  # contract will satisfy type or not.
  val.is_a?(Mon::M::Future) and (val.is_a?(Mon::M::FutureComplete).implies(valid_nested_contract?(val._)))
end