Sha256: 5556104940ee7594091e104c248219bbed2bfaa4dc1cb838f43356a9f93c387f

Contents?: true

Size: 823 Bytes

Versions: 3

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

# Attach configuration to the DrawIO DSL module
# :nocov:
module DrawioDsl
  # Used to attach configuration to KConfig module
  module ConfigurationShapes
    ShapeDefaults   = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
    Shapes = Struct.new(
      :shape,
      {{#each shapes}}
      :{{snake ./type}},
      {{/each}}
      keyword_init: true
    )

    def add_shapes
      @shapes = Shapes.new(
        shape: ShapeDefaults.new(type: :shape, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
        {{#each shapes}}
        {{snake ./type}}: ShapeDefaults.new(type: :{{snake ./type}}, x: {{./x}}, y: {{./y}}, w: {{./w}}, h: {{./h}}, style_modifiers: '{{{./style_modifiers}}}'){{#if @last}}{{^}},{{/if}}
        {{/each}}
      )
    end
  end
end
# :nocov:

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
drawio_dsl-0.5.2 .builders/.templates/basic/configuration_shapes.rb
drawio_dsl-0.5.1 .builders/.templates/basic/configuration_shapes.rb
drawio_dsl-0.5.0 .builders/.templates/basic/configuration_shapes.rb