FullBox type
Direct parent types
- Box
A box which might (FullBox) or might not (EmptyBox) contain a value. Box is somewhat similar to Arr of zero (EmptyBox) or exactly one (FullBox) element. This analogy helps understanding each() and filter() operation. Direct subtypes: 2
Direct children types
- Absent
Represents a target configuration list item that must be absent
- ExactPresence
Represents a target configuration list item in a list
- PartialPresence
Undocumented Direct subtypes: 2
- Present
Represents a target configuration list item that must be present
- TestMessage
Represents an informational, human readable message a successful test would present to the user.
- AWS::RouteBox
Internal type. Please do not use.
- AWS::IpPermBox
Internal type. Please do not use.
- AWS2::CreateOnly
A Box for a property which is to be used only at creation time, not when a resource is updated
Methods
- Bool(fb:FullBox) Source: stdlib.ngs:4218
Always true
- dflt(fb:FullBox, x:Any) Source: stdlib.ngs:4355
Do nothing Returns
fbExample
my_array = [10, 20] # dflt on FullBox has no effect my_array.Box(1).dflt(100).map(X*2).each(echo) # HERE # output: 40 # dflt on EmptyBox creates FullBox with the given value my_array.Box(5).dflt(100).map(X*2).each(echo) # output: 200
- each(fb:FullBox, cb:Fun) Source: stdlib.ngs:4240
Call cb with the value of the FullBox Returns
fbExample
Box(10).each(echo) # Output: 10
- filter(fb:FullBox, pattern:Any=method) Source: stdlib.ngs:4265
Conditionally convert FullBox to EmptyBox. Parameters
pattern Test function or anything else acceptable by =~ to be called with the value in the FullBox, defaults to Bool.constructors Returns
Box. fb if pattern succeeds, EmptyBox if not.Example
Box(10).filter(X>5) # <FullBox val=10> Box(10).filter(X>20) # <EmptyBox>
- get(fb:FullBox, dflt:Any=null) Source: stdlib.ngs:4277
Get FullBox value Returns
AnyExample
Box(10).get() # 10
- init(b:FullBox, *args:Arr) Source: stdlib.ngs:4202
Do not use directly! Helper constructor that throws InvalidArgument when FullBox is created with zero or more than one argument.
- init(b:FullBox, val:Any) Source: stdlib.ngs:4215
FullBox constructor. Saves val into .val Example
# Simplified code from the_one() method: ret = EmptyBox() something.each(F(elt) { if elt =~ pattern { ret throws ElementNotFound("the_one() had more than one match") } ret = FullBox(elt) }) not(ret) throws ElementNotFound("the_one() had no matches") ret.val # Has the value
- JsonData(fb:FullBox) Source: stdlib.ngs:4392
Convert FullBox into JSON compatible data structure - the contents of the box
- len(fb:FullBox) Source: stdlib.ngs:4293
Length of FullBox Returns
1
- map(fb:FullBox, mapper:Fun) Source: stdlib.ngs:4230
Map FullBox value Parameters
mapper mapper to be called with the FullBox value Returns
FullBox with value returned by mapperExample
Box(10).map(X*2) # <FullBox val=20>