Sha256: 0eeacf48642e18c91f3957d4ed1486877c7c4d7c0beab6e3202ada05200465ab

Contents?: true

Size: 885 Bytes

Versions: 29

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

# Work with HTML formatters to DrawIO shapes
module DrawioDsl
  # HTML formatters can be used on shapes to render HTML using a DSL
  module Formatters
    # Create an instance of a HTML formatter on the shape
    module Factory
      include KLog::Logging

      FORMATTERS = {
        klass: DrawioDsl::Formatters::KlassFormatter,
        class: DrawioDsl::Formatters::KlassFormatter, # alias for klass
        interface: DrawioDsl::Formatters::InterfaceFormatter
      }.freeze

      def format_instance(type)
        unless FORMATTERS.key?(type)
          log.error "Unknown formatter type: #{type}"
          @formatter = nil
          return formatter
        end

        @formatter = FORMATTERS[type].new
        formatter
      end

      def formatter
        @formatter ||= DrawioDsl::Formatters::BaseFormatter.new
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
drawio_dsl-0.12.4 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.12.3 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.12.2 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.12.1 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.12.0 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.8 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.7 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.6 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.5 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.4 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.3 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.2 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.1 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.11.0 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.10.1 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.10.0 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.9.0 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.8.11 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.8.10 lib/drawio_dsl/formatters/factory.rb
drawio_dsl-0.8.9 lib/drawio_dsl/formatters/factory.rb