# addRule

abstract fun addRule(rule: Rule): Rule(source)

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

#### Return

The added rule.

#### Since

1.0

#### Parameters

rule

The rule to add.

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

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.

#### Since

1.0

#### 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(source)

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.