Class: Mon::Contract::React

Inherits:
MonadContract
  • Object
show all
Defined in:
lib/contracts/reactron.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)


16
17
18
19
20
# File 'lib/contracts/reactron.rb', line 16

def valid?(val)
  # Should be a React (i.e. success or failure), and if it's a 
  # success, the value should be valid re: the provided contract
  val.is_a?(Mon::M::React) and (valid_nested_contract?(val._))
end