If Class

Summary

Evaluates a series of child modules for each input document if a specified condition is met.
Assembly
Wyam.Core.dll
Namespace
Wyam.Core.Modules.Control
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type-.->Interface1["IList<IfCondition>"] Type["If"] class Type type-node

Syntax

public class If : IModule, IList<IfCondition>

Remarks

Any result documents from the child modules will be returned as the result of the this module. Any input documents that don't match a predicate will be returned as outputs without modification.

Constructors

Name Summary
If(ContextConfig, IModule[]) Specifies a predicate and a series of child modules to be evaluated if the predicate returns true. The predicate will be evaluated once for all input documents.
If(DocumentConfig, IModule[]) Specifies a predicate and a series of child modules to be evaluated if the predicate returns true. The predicate will be evaluated against every input document individually.

Properties

Name Value Summary
Count int
IsReadOnly bool
this[int] IfCondition

Methods

Name Value Summary
Add(IfCondition) void
Clear() void
Contains(IfCondition) bool
CopyTo(IfCondition[], int) void
Else(IModule[]) IModule
This should be at the end of your fluent method chain and will evaluate the specified child modules on all documents that did not satisfy previous predicates. The predicate will be evaluated against every input document individually.
ElseIf(ContextConfig, IModule[]) If
Specifies an alternate condition to be tested on documents that did not satisfy previous conditions. You can chain together as many ElseIf calls as needed. The predicate will be evaluated once for all input documents.
ElseIf(DocumentConfig, IModule[]) If
Specifies an alternate condition to be tested on documents that did not satisfy previous conditions. You can chain together as many ElseIf calls as needed. The predicate will be evaluated against every input document individually.
Execute(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<IDocument>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
GetEnumerator() IEnumerator<IfCondition>
IndexOf(IfCondition) int
Insert(int, IfCondition) void
Remove(IfCondition) bool
RemoveAt(int) void
WithoutUnmatchedDocuments(bool) If
The default behavior of this module is to "fall through" any documents that didn't match one of the conditions and add it to the result set. This method allows you to change that behavior and prevent unmatched documents from being added to the result set.
GitHub