Class Adapt

Base class for Expect and Subject.

This class follows the pattern from Lua classes.

Metamethods

Adapt:__index (key) Lookup of missing class members.
Adapt:__call (...) Get a clone or create a new instance.

Methods

Adapt:create (...) Create a new instance.
Adapt:_init (...) Initialize a new instance.
Adapt:setAdaptations (obj) Set the reference to the adaptations collection.
Adapt:adaptations () Expose reference to adaptations.
Adapt:setReports (obj) Set the reference to the reports collection.
Adapt:reports () Expose reference to reports.
Adapt:temporal () Get the temporal.
Adapt:report () Get the report.
Adapt:eval () Evaluate the registered processes with temporal as arguments.
Adapt:first () [pick] Make a pick for first item.
Adapt:second () [pick] Make a pick for second item.
Adapt:third () [pick] Make a pick for third item.
Adapt:fourth () [pick] Make a pick for fourth item.
Adapt:fifth () [pick] Make a pick for fifth item.
Adapt:sixth () [pick] Make a pick for sixth item.
Adapt:seventh () [pick] Make a pick for seventh item.
Adapt:eight () [pick] Make a pick for eight item.
Adapt:ninth () [pick] Make a pick for ninth item.
Adapt:tenth () [pick] Make a pick for tenth item.
Adapt:eleventh () [pick] Make a pick for eleventh item.
Adapt:twelfth () [pick] Make a pick for twelfth item.
Adapt:asType () [transform] Make a transform to get the argument type.
Adapt:asUpper () [transform] Make a transform to get the string as upper case.
Adapt:asLower () [transform] Make a transform to get the string as lower case.
Adapt:asUpperFirst () [transform] Make a transform to get the string with first char as upper case.
Adapt:asLowerFirst () [transform] Make a transform to get the string with first char as lower case.
Adapt:asReverse () [transform] Make a transform to get the string reversed.
Adapt:asUUpper () [transform] Make a transform to get the ustring as upper case.
Adapt:asULower () [transform] Make a transform to get the ustring as lower case.
Adapt:asUUpperFirst () [transform] Make a transform to get the ustring with first code point as upper case.
Adapt:asULowerFirst () [transform] Make a transform to get the ustring with first code point as lower case.
Adapt:asUNFC () [transform] Make a transform to get the ustring as Normalized Form "C".
Adapt:asUNFD () [transform] Make a transform to get the ustring as Normalized Form "D".
Adapt:asNumber () [transform] Make a transform to get the string as number.
Adapt:asString () [transform] Make a transform to get the number as string.
Adapt:asFloor () [transform] Make a transform to get the next lower number.
Adapt:asCeil () [transform] Make a transform to get the next higher number.
Adapt:asRound () [transform] Make a transform to get the rounded number.
Adapt:asInteger () [transform] Make a transform to get the integer part of the number.
Adapt:asFraction () [transform] Make a transform to get the fraction part of the number.
Adapt:setOther (func) Set the accessor for the other party.
Adapt:other () Get the other part.
Adapt:reorder (...) Reorder the pair of parties involved in the condition.
Adapt:toBeEqual () [condition] Make a comparison to check equality.
Adapt:toBeBooleanEqual () [condition] Make a comparison to check boolean equality.
Adapt:toBeStrictEqual () [condition] Make a comparison to check strict equality.
Adapt:toBeSame () [condition] Make a comparison to check similarity.
Adapt:toBeDeepEqual () [condition] Make a comparison to check deep equality.
Adapt:toBeContained () [condition] Make a comparison to check if first is contained in second.
Adapt:toBeLesserThan () [condition] Make a comparison to check if first is strict lesser than second.
Adapt:toBeGreaterThan () [condition] Make a comparison to check if first is strict greater than second.
Adapt:toBeLesserOrEqual () [condition] Make a comparison to check if first is lesser or equal than second.
Adapt:toBeGreaterOrEqual () [condition] Make a comparison to check if first is strict greater or equal than second.
Adapt:toBeMatch () [condition] Make a comparison to check if first is a match in second.
Adapt:toBeUMatch () [condition] Make a comparison to check if first is an Unicode match in second.


Metamethods

Adapt:__index (key)
Lookup of missing class members.

Parameters:

Returns:

any

Raises:

on wrong arguments
Adapt:__call (...)
Get a clone or create a new instance.

Parameters:

  • ... vararg conditionally passed to create

Returns:

self

Methods

Adapt:create (...)
Create a new instance. Assumption is either to create a new instance from an existing class, or from a previous instance of some kind.

Parameters:

  • ... vararg set to temporal

Returns:

self
Adapt:_init (...)
Initialize a new instance.

Parameters:

  • ... vararg set to temporal

Returns:

self
Adapt:setAdaptations (obj)
Set the reference to the adaptations collection. This keeps a reference, the object is not cloned.

Parameters:

  • obj table that somehow maintain a collection

Returns:

self

Raises:

on wrong arguments
Adapt:adaptations ()
Expose reference to adaptations. If no report is set, then a new one is created.

Returns:

list of adaptations
Adapt:setReports (obj)
Set the reference to the reports collection. This keeps a reference, the object is not cloned.

Parameters:

  • obj table that somehow maintain a collection

Returns:

self

Raises:

on wrong arguments
Adapt:reports ()
Expose reference to reports. If no report is set, then a new one is created.

Returns:

list of reports
Adapt:temporal ()
Get the temporal. Will not return a table unless it is packed in a table itself.

Returns:

list|any
Adapt:report ()
Get the report. If no report is set, then a new one is created.

Returns:

ReportAdapt
Adapt:eval ()
Evaluate the registered processes with temporal as arguments.

Returns:

list of any
Adapt:first () [pick]
Make a pick for first item.
Adapt:second () [pick]
Make a pick for second item.
Adapt:third () [pick]
Make a pick for third item.
Adapt:fourth () [pick]
Make a pick for fourth item.
Adapt:fifth () [pick]
Make a pick for fifth item.
Adapt:sixth () [pick]
Make a pick for sixth item.
Adapt:seventh () [pick]
Make a pick for seventh item.
Adapt:eight () [pick]
Make a pick for eight item.
Adapt:ninth () [pick]
Make a pick for ninth item.
Adapt:tenth () [pick]
Make a pick for tenth item.
Adapt:eleventh () [pick]
Make a pick for eleventh item.
Adapt:twelfth () [pick]
Make a pick for twelfth item.
Adapt:asType () [transform]
Make a transform to get the argument type.

Nicknames:

    Adapt:type
Adapt:asUpper () [transform]
Make a transform to get the string as upper case.

Nicknames:

  • Adapt:upper
  • Adapt:asUC
  • Adapt:uc
Adapt:asLower () [transform]
Make a transform to get the string as lower case.

Nicknames:

  • Adapt:lower
  • Adapt:asLC
  • Adapt:lc
Adapt:asUpperFirst () [transform]
Make a transform to get the string with first char as upper case.

Nicknames:

  • Adapt:upperfirst
  • Adapt:asUCFirst
  • Adapt:asUCfirst
  • Adapt:ucfirst
Adapt:asLowerFirst () [transform]
Make a transform to get the string with first char as lower case.

Nicknames:

  • Adapt:lowerfirst
  • Adapt:asLCFirst
  • Adapt:asLCfirst
  • Adapt:lcfirst
Adapt:asReverse () [transform]
Make a transform to get the string reversed.

Nicknames:

    Adapt:reverse
Adapt:asUUpper () [transform]
Make a transform to get the ustring as upper case.

Nicknames:

  • Adapt:uupper
  • Adapt:asUUC
  • Adapt:uuc
Adapt:asULower () [transform]
Make a transform to get the ustring as lower case.

Nicknames:

  • Adapt:ulower
  • Adapt:asULC
  • Adapt:ulc
Adapt:asUUpperFirst () [transform]
Make a transform to get the ustring with first code point as upper case.

Nicknames:

  • Adapt:uupperfirst
  • Adapt:asUUCFirst
  • Adapt:asUUCfirst
  • Adapt:uucfirst
Adapt:asULowerFirst () [transform]
Make a transform to get the ustring with first code point as lower case.

Nicknames:

  • Adapt:ulowerfirst
  • Adapt:asULCFirst
  • Adapt:asULCfirst
  • Adapt:ulcfirst
Adapt:asUNFC () [transform]
Make a transform to get the ustring as Normalized Form "C".

Nicknames:

  • Adapt:unfc
  • Adapt:uNFC
  • Adapt:nfc
Adapt:asUNFD () [transform]
Make a transform to get the ustring as Normalized Form "D".

Nicknames:

  • Adapt:unfd
  • Adapt:uNFD
  • Adapt:nfd
Adapt:asNumber () [transform]
Make a transform to get the string as number.

Nicknames:

  • Adapt:number
  • Adapt:asNum
  • Adapt:num
Adapt:asString () [transform]
Make a transform to get the number as string.

Nicknames:

  • Adapt:string
  • Adapt:asStr
  • Adapt:str
Adapt:asFloor () [transform]
Make a transform to get the next lower number.

Nicknames:

    Adapt:floor
Adapt:asCeil () [transform]
Make a transform to get the next higher number.

Nicknames:

    Adapt:ceil
Adapt:asRound () [transform]
Make a transform to get the rounded number.

Nicknames:

    Adapt:round
Adapt:asInteger () [transform]
Make a transform to get the integer part of the number.

Nicknames:

  • Adapt:integer
  • Adapt:asInt
  • Adapt:int
Adapt:asFraction () [transform]
Make a transform to get the fraction part of the number.

Nicknames:

  • Adapt:fraction
  • Adapt:asFrac
  • Adapt:frac
Adapt:setOther (func)
Set the accessor for the other party. For a subject the other part will be the expect, and for expect it will be the subject.

Parameters:

  • func function that points to the other party in a comparation

Returns:

self

Raises:

on wrong arguments
Adapt:other ()
Get the other part. Note that this is the real other part, and not a previously set accessor.

Returns:

nil,Adapt
Adapt:reorder (...)
Reorder the pair of parties involved in the condition. This can be overridden in subclasses. Standard version which does an identity operation, that is it does not reorder arguments.

Parameters:

  • ... vararg

Returns:

list
Adapt:toBeEqual () [condition]
Make a comparison to check equality.

Nicknames:

  • Adapt:equal
  • Adapt:isEqual
  • Adapt:ifEqual
Adapt:toBeBooleanEqual () [condition]
Make a comparison to check boolean equality.

Nicknames:

  • Adapt:booleanequal
  • Adapt:isBooleanEqual
  • Adapt:ifBooleanEqual
Adapt:toBeStrictEqual () [condition]
Make a comparison to check strict equality.

Nicknames:

  • Adapt:strictequal
  • Adapt:isStrictEqual
  • Adapt:ifStrictEqual
Adapt:toBeSame () [condition]
Make a comparison to check similarity.

Nicknames:

  • Adapt:same
  • Adapt:isSame
  • Adapt:ifSame
Adapt:toBeDeepEqual () [condition]
Make a comparison to check deep equality.

Nicknames:

  • Adapt:deepequal
  • Adapt:isDeepEqual
  • Adapt:ifDeepEqual
Adapt:toBeContained () [condition]
Make a comparison to check if first is contained in second.

Nicknames:

  • Adapt:contained
  • Adapt:isContained
  • Adapt:ifContained
Adapt:toBeLesserThan () [condition]
Make a comparison to check if first is strict lesser than second.

Nicknames:

  • Adapt:lesser
  • Adapt:lt
  • Adapt:toBeLesser
  • Adapt:toBeLT
  • Adapt:isLesser
  • Adapt:isLT
  • Adapt:ifLesser
  • Adapt:ifLt
Adapt:toBeGreaterThan () [condition]
Make a comparison to check if first is strict greater than second.
Adapt:toBeLesserOrEqual () [condition]
Make a comparison to check if first is lesser or equal than second.
Adapt:toBeGreaterOrEqual () [condition]
Make a comparison to check if first is strict greater or equal than second.
Adapt:toBeMatch () [condition]
Make a comparison to check if first is a match in second.
Adapt:toBeUMatch () [condition]
Make a comparison to check if first is an Unicode match in second.
generated by LDoc 1.4.6