ModraUp Ruby API Documentation Ruby API Reference

Class: ModraUp::LineStyles

Inherits:
ModraUp::Entity show all
Includes:
Enumerable

Overview

Built-in line styles for the model. Retrieve them by name or index using ModraUp::LineStyle.

Examples:

styles = ModraUp.active_model.line_styles
styles["Dash"]
styles.names

Instance Method Summary # collapse

Inherited from ModraUp::Entity

Instance Method Details

line_styles[name] ⇒ ModraUp::LineStyle, nilline_styles[index] ⇒ ModraUp::LineStyle, nil

Retrieve line styles by their English name or index starting from 0. Return nil if the name does not exist.

Parameters:

  • name (String, Integer)

Returns:

  • (ModraUp::LineStyle, nil)

Raises:

  • [ IndexError ] out-of-bounds index

Examples:

ModraUp.active_model.line_styles["Dash"]
ModraUp.active_model.line_styles[2]

line_styles.at(name) ⇒ ModraUp::LineStyle, nilline_styles.at(index) ⇒ ModraUp::LineStyle, nil

Alias for #[].

Parameters:

  • name (String, Integer)

Returns:

  • (ModraUp::LineStyle, nil)

Raises:

  • [ IndexError ] out-of-bounds index

Examples:

ModraUp.active_model.line_styles.at("Dash")

line_styles.names ⇒ Array<String>

12 built-in English names.

Returns:

  • (Array<String>)

Examples:

ModraUp.active_model.line_styles.names.include?("Dash")

line_styles.size ⇒ Integer

Number of built-in line styles.

Returns:

  • (Integer)

Examples:

ModraUp.active_model.line_styles.size  #=> 12

line_styles.length ⇒ Integer

Alias for #size.

Returns:

  • (Integer)

Examples:

ModraUp.active_model.line_styles.length  #=> 12

line_styles.each {|style| } ⇒ nilline_styles.each ⇒ Enumerator

Iterate through all built-in line styles.

Returns:

  • (nil, Enumerator)

Yields:

  • @yieldparam style [ModraUp::LineStyle]

Examples:

ModraUp.active_model.line_styles.each { |s| s.name }

line_styles.to_a ⇒ Array<ModraUp::LineStyle>

All line styles.

Returns:

  • (Array<ModraUp::LineStyle>)

Examples:

ModraUp.active_model.line_styles.to_a.map(&:name)