#cp.rx.go.Require

A Statement that will require that the resolvable value matches a predicate, and if not, it will send an error.


#Submodules


#API Overview

Constants - Useful values which cannot be changed

Functions - API calls offered directly by the extension

Methods - API calls which can only be made on an object returned by a constructor


#API Documentation

#Constants

Signaturecp.rx.go.Require.OrThrow <cp.rx.go.Statement.Modifier>
TypeConstant
DescriptionA Statement.Modifier that sets the message to throw if the requirement is not met.
NotesNone
Sourcesrc/extensions/cp/rx/go/Require.lua line 59

#Functions

Signaturecp.rx.go.Require(requirement) -> Require
TypeFunction
DescriptionCreates a new Require Statement with the specified requirement.
Parameters
  • requirement - a resolvable value that will be checked.
Returns
  • The Statement instance which will check if the requirement matches the requirement.
Notes
  • By default, it will require that all items in the requirement are not nil and completed.
  • This is most useful with Given, allowing retrieval and checking of values before continuing.
  • Example:
  • lua</li><li>Given(</li><li> Require(someObservable):Is(2):OrThrow("Must be 2")</li><li>):Then(function(someValue)</li><li> -- do stuff with `someValue`</li><li>):Now()</li><li>
ExamplesNone
Sourcesrc/extensions/cp/rx/go/Require.lua line 16

#Methods

Signaturecp.rx.go.Require:Are(value) -> Require.Are
TypeMethod
DescriptionSpecifies the value to check.
Parameters
  • value - The value that all results from the requirement must match.
Returns
  • The Are Statement.Modifier.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/go/Require.lua line 105

Signaturecp.rx.go.Require:AreNot(value) -> Require.AreNot
TypeMethod
DescriptionSpecifies the value to check.
Parameters
  • value - The value that all results from the requirement must match.
Returns
  • The AreNot Statement.Modifier.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/go/Require.lua line 170

Signaturecp.rx.go.Require:Is(value) -> Require.Is
TypeMethod
DescriptionSpecifies the value to check.
Parameters
  • value - The value that all results from the requirement must match.
Returns
  • The Is Statement.Modifier.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/go/Require.lua line 87

Signaturecp.rx.go.Require:IsNot(value) -> Require.IsNot
TypeMethod
DescriptionSpecifies the value to check.
Parameters
  • value - The value that all results from the requirement must not match.
Returns
  • The IsNot Statement.Modifier.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/go/Require.lua line 152

Signaturecp.rx.go.Require:Matches(predicate) -> Require.Matches
TypeMethod
DescriptionSpecifies the predicate to check.
Parameters
  • value - The value that all results from the requirement must not match.
Returns
  • The Matches Statement.Modifier.
Notes
  • Example:
  • lua</li><li>Require(someObservable):Matches(function(value) return value % 2 == 0 end)</li><li>
ExamplesNone
Sourcesrc/extensions/cp/rx/go/Require.lua line 217

Signaturecp.rx.go.Require:OrThrow(message) -> Require.OrThrow
TypeMethod
DescriptionSpecifies the message to throw if the requirement is not met.
Parameters
  • message - The string to throw when there is an error.
Returns
  • The OrThrow Statement.Modifier.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/go/Require.lua line 63