# Class LittleGhost::Decision

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/Decision.html

Declarative collection of typed questions for one decision request.

Subclass and declare a model plus one or more typed questions, then call
+.ask(state)+ or instantiate the class and call +#ask(state)+.

## Inheritance

`LittleGhost::Decision < Object`

## Class methods

<a id="method-c-ask"></a>
### `.ask`

```ruby
.ask(state, **options)
```

Runs all declared questions against `state`.

<a id="method-c-choice"></a>
### `.choice`

```ruby
.choice(id, instructions:, criteria:, **options)
```

Declares a choice question. Criteria may be an array of labels or a mapping
from labels to their descriptions.

<a id="method-c-model"></a>
### `.model`

```ruby
.model(value = :__read__)
```

Selects a direct target or configured model role for this decision.

<a id="method-c-new"></a>
### `.new`

```ruby
.new(runtime: LittleGhost.runtime)
```

Binds this decision instance to a Runtime.

<a id="method-c-noul"></a>
### `.noul`

```ruby
.noul(id, instructions:, criteria: nil, **options)
```

Declares a yes/no (noul) question, optionally with decision criteria.

<a id="method-c-questions"></a>
### `.questions`

```ruby
.questions()
```

Returns the immutable question declarations for this class.

<a id="method-c-score"></a>
### `.score`

```ruby
.score(id, instructions:, criteria:, **options)
```

Declares a score question with ordered scoring criteria.

## Instance methods

<a id="method-i-ask"></a>
### `#ask`

```ruby
#ask(state, **options)
```

Runs this decision's questions against `state`.
