Module: Ea::Svg::EaEmitter::Compartment::Operations

Defined in:
lib/ea/svg/ea_emitter/compartment/operations.rb

Overview

Operation compartment: divider line + operation signatures. Skipped when no operations or when geometry cannot fit them.

Class Method Summary collapse

Class Method Details

.render(context) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ea/svg/ea_emitter/compartment/operations.rb', line 12

def render(context)
  return nil unless context.op_lines.any?
  return nil unless context.geometry.op_first_y
  return nil unless context.classifier

  parts = []
  if context.attr_lines.any?
    parts << Element::DividerRenderer.render(
      context.bounds,
      y: context.geometry.op_divider_y,
      stroke: context.stroke,
      stroke_width: context.stroke_width
    )
  end
  parts << Element::OperationRenderer.render(
    context.classifier.operations,
    bounds: context.bounds,
    first_y: context.geometry.op_first_y,
    family: context.family, size: context.size
  )
  parts.join("\n")
end