API / Entities

ScenarioEntity

Represents a preview scenario method within a preview class.

Instance Methods

Annotations

# notes → String

Any notes added to the entity. Returns the raw (unrendered) string which may contain markdown formatting.

# tag (name = nil) → Array<YardTag>

The first tag (optionally of a particular type) added to the entity.

Arguments:

name Symbol

Optional tag type to filter by

Example:

first_tag = entity.tag
first_display_tag = entity.tag(:display)
# tags (name = nil) → Array<YardTag>

All tags that have been added to the entity. Can be filtered by tag name by providing the name as an argument.

Arguments:

name Symbol

Optional tag type to filter by

Example:

all_tags = entity.tags
display_tags = entity.tags(:display)

Display options

# display_options → Hash

Display options hash.

Identity

# id → String

Human-readable unique scenario ID.

# label → String

Titlized name for use in navigation etc.

# name → String

Parameter-safe scenario name.

# type → Symbol

Entity type identifier. Returns :scenario for scenarios.

Paths

# lookup_path → String

Canonical reference path.

Aliases:

#path

Render Targets

# render_target → RenderableEntity

The item (component or partial) that the scenario renders.

Example:

"This scenario renders: #{scenario.render_target.label}"

Aliases:

#component

Source

# source → String

Scenario method source code.

# source_lang → Hash

Source code language info.

Example:

source_lang_name = entity.lang[:name]

URLs

# inspect_path → String

The inspector URL path for this preview.

Aliases:

#url_path
# preview_path → String

The standalone preview URL path for this preview.

Visibility

# hidden? → Boolean

Whether or not the entity is hidden (i.e. hidden from navigation).

# visible? → Boolean

Whether or not the entity is visible (i.e. present in navigation).

Other

# preview → PreviewEntity

The preview that this scenario belongs to.

Aliases:

#parent

User Guide

Extending Lookbook

API

Elsewhere