Module: Ea::Svg::EaEmitter::Element::HeaderLinePipeline

Defined in:
lib/ea/svg/ea_emitter/element/header_line_pipeline.rb

Overview

OCP-friendly header line pipeline. Each contributor is a stateless provider that appends 0+ lines to the output. New behaviors add a new provider to PROVIDERS without modifying existing ones.

Context (Struct) carries everything a provider might need:

classifier, diagram_package_id, visually_nested,
umldi_keyword, bounds_width, font_size,
off_canvas_parent_name

Each provider implements:

def self.call(context)  →  Array<[[text, style], ...]>

Defined Under Namespace

Classes: Context

Constant Summary collapse

PROVIDERS =
[
  HeaderLineProvider::ParentGhost,
  HeaderLineProvider::InstanceSpec,
  HeaderLineProvider::StereotypeLabel,
  HeaderLineProvider::Name
].freeze

Class Method Summary collapse

Class Method Details

.for(classifier, **opts) ⇒ Array<Array(String, Symbol)>

Returns list of [text, style] pairs.

Parameters:

Returns:

  • (Array<Array(String, Symbol)>)

    list of [text, style] pairs



35
36
37
38
# File 'lib/ea/svg/ea_emitter/element/header_line_pipeline.rb', line 35

def self.for(classifier, **opts)
  context = Context.new(classifier: classifier, **opts)
  PROVIDERS.flat_map { |provider| provider.call(context) }
end