Class: AsciidoctorDiagramLayout::Renderer::RenderOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoctor_diagram_layout/renderer/render_options.rb

Overview

Configuration for a single render pass.

Examples:

Custom palette and dimensions

RenderOptions.new(width: "800px", height: "400px", palette: "pastel", title: "My Layout")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width: "100%", height: nil, title: nil, palette: "rainbow", pdf: false, color_scheme: nil, name_converter: nil) ⇒ RenderOptions

Returns a new instance of RenderOptions.

Parameters:

  • width (String) (defaults to: "100%")

    CSS width (e.g. “100%”, “600px”)

  • height (String, nil) (defaults to: nil)

    CSS height or nil

  • title (String, nil) (defaults to: nil)

    diagram caption

  • palette (String) (defaults to: "rainbow")
  • pdf (Boolean) (defaults to: false)

    whether the output backend is PDF

  • color_scheme (Scheme::ColorScheme, nil) (defaults to: nil)

    pre-resolved scheme, skips factory

  • name_converter (Proc, nil) (defaults to: nil)

    Callable receiving a cell name and returning a rendered label. Defaults to XML-escaping.



21
22
23
24
25
26
27
28
# File 'lib/asciidoctor_diagram_layout/renderer/render_options.rb', line 21

def initialize(width: "100%", height: nil, title: nil, palette: "rainbow", pdf: false,
               color_scheme: nil, name_converter: nil)
  @width          = width
  @height         = height
  @title          = title
  @color_scheme   = color_scheme || Scheme::CellColorSchemeFactory.resolve(palette, pdf: pdf)
  @name_converter = name_converter || ->(text) { escape(text) }
end

Instance Attribute Details

#color_schemeObject (readonly)

Returns the value of attribute color_scheme.



10
11
12
# File 'lib/asciidoctor_diagram_layout/renderer/render_options.rb', line 10

def color_scheme
  @color_scheme
end

#heightObject (readonly)

Returns the value of attribute height.



10
11
12
# File 'lib/asciidoctor_diagram_layout/renderer/render_options.rb', line 10

def height
  @height
end

#name_converterObject (readonly)

Returns the value of attribute name_converter.



10
11
12
# File 'lib/asciidoctor_diagram_layout/renderer/render_options.rb', line 10

def name_converter
  @name_converter
end

#titleObject (readonly)

Returns the value of attribute title.



10
11
12
# File 'lib/asciidoctor_diagram_layout/renderer/render_options.rb', line 10

def title
  @title
end

#widthObject (readonly)

Returns the value of attribute width.



10
11
12
# File 'lib/asciidoctor_diagram_layout/renderer/render_options.rb', line 10

def width
  @width
end