Class: RailroadDiagrams::Options

Inherits:
Struct
  • Object
show all
Defined in:
lib/railroad_diagrams/options.rb,
sig/generated/railroad_diagrams/options.rbs

Overview

Immutable-by-convention rendering settings used by Diagram output methods.

Examples:

RailroadDiagrams.default_options.merge(theme: :dark)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ambiguous_width ⇒ Object

Returns the value of attribute ambiguous_width

Returns:

  • (Object) —

    the current value of ambiguous_width



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def ambiguous_width
  @ambiguous_width
end

#arc_radius ⇒ Object

Returns the value of attribute arc_radius

Returns:

  • (Object) —

    the current value of arc_radius



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def arc_radius
  @arc_radius
end

#char_width ⇒ Object

Returns the value of attribute char_width

Returns:

  • (Object) —

    the current value of char_width



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def char_width
  @char_width
end

#coerce ⇒ Object

Returns the value of attribute coerce

Returns:

  • (Object) —

    the current value of coerce



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def coerce
  @coerce
end

#comment_char_width ⇒ Object

Returns the value of attribute comment_char_width

Returns:

  • (Object) —

    the current value of comment_char_width



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def comment_char_width
  @comment_char_width
end

#debug ⇒ Object

Returns the value of attribute debug

Returns:

  • (Object) —

    the current value of debug



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def debug
  @debug
end

#diagram_class ⇒ Object

Returns the value of attribute diagram_class

Returns:

  • (Object) —

    the current value of diagram_class



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def diagram_class
  @diagram_class
end

#escape_html ⇒ Object

Returns the value of attribute escape_html

Returns:

  • (Object) —

    the current value of escape_html



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def escape_html
  @escape_html
end

#href_mode ⇒ Object

Returns the value of attribute href_mode

Returns:

  • (Object) —

    the current value of href_mode



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def href_mode
  @href_mode
end

#id_prefix ⇒ Object

Returns the value of attribute id_prefix

Returns:

  • (Object) —

    the current value of id_prefix



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def id_prefix
  @id_prefix
end

#inline_styles ⇒ Object

Returns the value of attribute inline_styles

Returns:

  • (Object) —

    the current value of inline_styles



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def inline_styles
  @inline_styles
end

#internal_alignment ⇒ Object

Returns the value of attribute internal_alignment

Returns:

  • (Object) —

    the current value of internal_alignment



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def internal_alignment
  @internal_alignment
end

Returns the value of attribute link_policy

Returns:

  • (Object) —

    the current value of link_policy



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def link_policy
  @link_policy
end

Returns the value of attribute link_policy_violation

Returns:

  • (Object) —

    the current value of link_policy_violation



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def link_policy_violation
  @link_policy_violation
end

Returns the value of attribute link_rel

Returns:

  • (Object) —

    the current value of link_rel



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def link_rel
  @link_rel
end

Returns the value of attribute link_target

Returns:

  • (Object) —

    the current value of link_target



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def link_target
  @link_target
end

#locale ⇒ Object

Returns the value of attribute locale

Returns:

  • (Object) —

    the current value of locale



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def locale
  @locale
end

#max_width ⇒ Object

Returns the value of attribute max_width

Returns:

  • (Object) —

    the current value of max_width



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def max_width
  @max_width
end

#measurer ⇒ Object

Returns the value of attribute measurer

Returns:

  • (Object) —

    the current value of measurer



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def measurer
  @measurer
end

#optimize_paths ⇒ Object

Returns the value of attribute optimize_paths

Returns:

  • (Object) —

    the current value of optimize_paths



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def optimize_paths
  @optimize_paths
end

#precision ⇒ Object

Returns the value of attribute precision

Returns:

  • (Object) —

    the current value of precision



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def precision
  @precision
end

#show_end ⇒ Object

Returns the value of attribute show_end

Returns:

  • (Object) —

    the current value of show_end



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def show_end
  @show_end
end

#show_start ⇒ Object

Returns the value of attribute show_start

Returns:

  • (Object) —

    the current value of show_start



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def show_start
  @show_start
end

#stroke_odd_pixel_length ⇒ Object

Returns the value of attribute stroke_odd_pixel_length

Returns:

  • (Object) —

    the current value of stroke_odd_pixel_length



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def stroke_odd_pixel_length
  @stroke_odd_pixel_length
end

#text_charset ⇒ Object

Returns the value of attribute text_charset

Returns:

  • (Object) —

    the current value of text_charset



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def text_charset
  @text_charset
end

#theme ⇒ Object

Returns the value of attribute theme

Returns:

  • (Object) —

    the current value of theme



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def theme
  @theme
end

#vertical_separation ⇒ Object

Returns the value of attribute vertical_separation

Returns:

  • (Object) —

    the current value of vertical_separation



8
9
10
# File 'lib/railroad_diagrams/options.rb', line 8

def vertical_separation
  @vertical_separation
end

Class Method Details

.new(vertical_separation:, arc_radius:, diagram_class:, stroke_odd_pixel_length:, internal_alignment:, char_width:, comment_char_width:, ambiguous_width:, measurer:, text_charset:, escape_html:, precision:, optimize_paths:, href_mode:, link_policy:, link_policy_violation:, link_target:, link_rel:, id_prefix:, debug:, locale:, theme:, inline_styles:, max_width:, show_start:, show_end:, coerce:) ⇒ instance .new(arg0) ⇒ instance

Overloads:

  • .new(vertical_separation:, arc_radius:, diagram_class:, stroke_odd_pixel_length:, internal_alignment:, char_width:, comment_char_width:, ambiguous_width:, measurer:, text_charset:, escape_html:, precision:, optimize_paths:, href_mode:, link_policy:, link_policy_violation:, link_target:, link_rel:, id_prefix:, debug:, locale:, theme:, inline_styles:, max_width:, show_start:, show_end:, coerce:) ⇒ instance

    Parameters:

    • vertical_separation: (Object)
    • arc_radius: (Object)
    • diagram_class: (Object)
    • stroke_odd_pixel_length: (Object)
    • internal_alignment: (Object)
    • char_width: (Object)
    • comment_char_width: (Object)
    • ambiguous_width: (Object)
    • measurer: (Object)
    • text_charset: (Object)
    • escape_html: (Object)
    • precision: (Object)
    • optimize_paths: (Object)
    • href_mode: (Object)
    • link_policy: (Object)
    • link_policy_violation: (Object)
    • link_target: (Object)
    • link_rel: (Object)
    • id_prefix: (Object)
    • debug: (Object)
    • locale: (Object)
    • theme: (Object)
    • inline_styles: (Object)
    • max_width: (Object)
    • show_start: (Object)
    • show_end: (Object)
    • coerce: (Object)

    Returns:

    • (instance)
  • .new(arg0) ⇒ instance

    Parameters:

    • arg0 ({ ?vertical_separation: untyped, ?arc_radius: untyped, ?diagram_class: untyped, ?stroke_odd_pixel_length: untyped, ?internal_alignment: untyped, ?char_width: untyped, ?comment_char_width: untyped, ?ambiguous_width: untyped, ?measurer: untyped, ?text_charset: untyped, ?escape_html: untyped, ?precision: untyped, ?optimize_paths: untyped, ?href_mode: untyped, ?link_policy: untyped, ?link_policy_violation: untyped, ?link_target: untyped, ?link_rel: untyped, ?id_prefix: untyped, ?debug: untyped, ?locale: untyped, ?theme: untyped, ?inline_styles: untyped, ?max_width: untyped, ?show_start: untyped, ?show_end: untyped, ?coerce: untyped })

    Returns:

    • (instance)


62
63
# File 'sig/generated/railroad_diagrams/options.rbs', line 62

def self.new: (?vertical_separation: untyped, ?arc_radius: untyped, ?diagram_class: untyped, ?stroke_odd_pixel_length: untyped, ?internal_alignment: untyped, ?char_width: untyped, ?comment_char_width: untyped, ?ambiguous_width: untyped, ?measurer: untyped, ?text_charset: untyped, ?escape_html: untyped, ?precision: untyped, ?optimize_paths: untyped, ?href_mode: untyped, ?link_policy: untyped, ?link_policy_violation: untyped, ?link_target: untyped, ?link_rel: untyped, ?id_prefix: untyped, ?debug: untyped, ?locale: untyped, ?theme: untyped, ?inline_styles: untyped, ?max_width: untyped, ?show_start: untyped, ?show_end: untyped, ?coerce: untyped) -> instance
| ({ ?vertical_separation: untyped, ?arc_radius: untyped, ?diagram_class: untyped, ?stroke_odd_pixel_length: untyped, ?internal_alignment: untyped, ?char_width: untyped, ?comment_char_width: untyped, ?ambiguous_width: untyped, ?measurer: untyped, ?text_charset: untyped, ?escape_html: untyped, ?precision: untyped, ?optimize_paths: untyped, ?href_mode: untyped, ?link_policy: untyped, ?link_policy_violation: untyped, ?link_target: untyped, ?link_rel: untyped, ?id_prefix: untyped, ?debug: untyped, ?locale: untyped, ?theme: untyped, ?inline_styles: untyped, ?max_width: untyped, ?show_start: untyped, ?show_end: untyped, ?coerce: untyped }) -> instance

Instance Method Details

#merge(**overrides) ⇒ Object

Return a copy with validated overrides.

Examples:

RailroadDiagrams.default_options.merge(locale: :ja)

Raises:



19
20
21
22
23
24
# File 'lib/railroad_diagrams/options.rb', line 19

def merge(**overrides)
  unknown = overrides.keys - members
  raise InvalidArgument, "unknown option(s): #{unknown.join(', ')}" unless unknown.empty?

  self.class.new(**to_h.merge(overrides)).freeze # rubocop:disable Style/KeywordArgumentsMerging
end