# addRule

abstract fun addRule(rule: Rule): Rule

Adds a rule to this collection. The given rule is invoked when an unknown object is requested by name.

#### Return

The added rule.

#### Parameters

rule

The rule to add.

abstract fun addRule(description: String, ruleAction: Closure): Rule

Adds a rule to this collection. The given closure is executed when an unknown object is requested by name. The requested name is passed to the closure as a parameter.

#### Return

The added rule.

#### Parameters

description

The description of the rule.

ruleAction

The closure to execute to apply the rule.

abstract fun addRule(description: String, ruleAction: Action<String>): Rule

Adds a rule to this collection. The given action is executed when an unknown object is requested by name. The requested name is passed to the action.

#### Return

The added rule.

#### Since

3.3

#### Parameters

description

The description of the rule.

ruleAction

The action to execute to apply the rule.