Sha256: f08f758f5e5896d4519e042121b0eb51078af643c85a864b41542980d2ff9c14
Contents?: true
Size: 978 Bytes
Versions: 4
Compression:
Stored size: 978 Bytes
Contents
# frozen_string_literal: true module DrawioDsl # DrawioDsl is a DSL for draw-io diagrams. class Drawio < KDirector::Directors::BaseDirector default_builder_type(DrawioDsl::DomBuilder) def diagram(**opts) builder.set_diagram(**opts) self end def page(name = nil, **opts, &block) page = DrawioDsl::DrawioPage.new(self, **opts.merge(name: name)) page.instance_eval(&block) if block_given? layout = DrawioDsl::LayoutEngine.new(builder.current_page) layout.call self end end # DrawioDsl::DrawioPage is created when you call .page on the draw-io DSL. class DrawioPage < KDirector::Directors::ChildDirector include DrawioDsl::DrawioShapes def initialize(parent, **opts) super(parent, **opts) builder.add_page(**opts) end def grid_layout(**opts) builder.add_grid_layout(**opts) end def flex_layout(**opts) builder.add_flex_layout(**opts) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
drawio_dsl-0.5.3 | lib/drawio_dsl/drawio.rb |
drawio_dsl-0.5.2 | lib/drawio_dsl/drawio.rb |
drawio_dsl-0.5.1 | lib/drawio_dsl/drawio.rb |
drawio_dsl-0.5.0 | lib/drawio_dsl/drawio.rb |