Class: Ea::Svg::EaEmitter::RenderContext
- Inherits:
-
Struct
- Object
- Struct
- Ea::Svg::EaEmitter::RenderContext
- Defined in:
- lib/ea/svg/ea_emitter/render_context.rb
Overview
Per-element render context. Holds the immutable inputs each compartment renderer needs (bounds, classifier, fill/stroke, font, geometry, line data). Built once per element; passed to every compartment in the pipeline so they don't reach back into the parent Elements orchestrator.
Value object: equality by structural attributes. Each instance is frozen after construction.
Instance Attribute Summary collapse
-
#attr_lines ⇒ Object
Returns the value of attribute attr_lines.
-
#bounds ⇒ Object
Returns the value of attribute bounds.
-
#canvas ⇒ Object
Returns the value of attribute canvas.
-
#classifier ⇒ Object
Returns the value of attribute classifier.
-
#constraints ⇒ Object
Returns the value of attribute constraints.
-
#diagram ⇒ Object
Returns the value of attribute diagram.
-
#element ⇒ Object
Returns the value of attribute element.
-
#enum_literals ⇒ Object
Returns the value of attribute enum_literals.
-
#family ⇒ Object
Returns the value of attribute family.
-
#fill ⇒ Object
Returns the value of attribute fill.
-
#geometry ⇒ Object
Returns the value of attribute geometry.
-
#header_lines ⇒ Object
Returns the value of attribute header_lines.
-
#model_element ⇒ Object
Returns the value of attribute model_element.
-
#model_index ⇒ Object
Returns the value of attribute model_index.
-
#off_canvas_parent_name ⇒ Object
Returns the value of attribute off_canvas_parent_name.
-
#op_lines ⇒ Object
Returns the value of attribute op_lines.
-
#package_content_lines ⇒ Object
Returns the value of attribute package_content_lines.
-
#size ⇒ Object
Returns the value of attribute size.
-
#size_unit ⇒ Object
Returns the value of attribute size_unit.
-
#stroke ⇒ Object
Returns the value of attribute stroke.
-
#stroke_width ⇒ Object
Returns the value of attribute stroke_width.
-
#tagged_values ⇒ Object
Returns the value of attribute tagged_values.
-
#text_fill ⇒ Object
Returns the value of attribute text_fill.
-
#theme ⇒ Object
Returns the value of attribute theme.
Instance Method Summary collapse
-
#content_below_header? ⇒ Boolean
Compartments below the header that produce a divider when any of them has content.
-
#model_index_for(id) ⇒ Object
Resolve a model element by id via the threaded model index.
- #note_body ⇒ Object
Instance Attribute Details
#attr_lines ⇒ Object
Returns the value of attribute attr_lines
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def attr_lines @attr_lines end |
#bounds ⇒ Object
Returns the value of attribute bounds
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def bounds @bounds end |
#canvas ⇒ Object
Returns the value of attribute canvas
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def canvas @canvas end |
#classifier ⇒ Object
Returns the value of attribute classifier
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def classifier @classifier end |
#constraints ⇒ Object
Returns the value of attribute constraints
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def constraints @constraints end |
#diagram ⇒ Object
Returns the value of attribute diagram
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def diagram @diagram end |
#element ⇒ Object
Returns the value of attribute element
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def element @element end |
#enum_literals ⇒ Object
Returns the value of attribute enum_literals
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def enum_literals @enum_literals end |
#family ⇒ Object
Returns the value of attribute family
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def family @family end |
#fill ⇒ Object
Returns the value of attribute fill
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def fill @fill end |
#geometry ⇒ Object
Returns the value of attribute geometry
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def geometry @geometry end |
#header_lines ⇒ Object
Returns the value of attribute header_lines
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def header_lines @header_lines end |
#model_element ⇒ Object
Returns the value of attribute model_element
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def model_element @model_element end |
#model_index ⇒ Object
Returns the value of attribute model_index
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def model_index @model_index end |
#off_canvas_parent_name ⇒ Object
Returns the value of attribute off_canvas_parent_name
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def off_canvas_parent_name @off_canvas_parent_name end |
#op_lines ⇒ Object
Returns the value of attribute op_lines
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def op_lines @op_lines end |
#package_content_lines ⇒ Object
Returns the value of attribute package_content_lines
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def package_content_lines @package_content_lines end |
#size ⇒ Object
Returns the value of attribute size
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def size @size end |
#size_unit ⇒ Object
Returns the value of attribute size_unit
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def size_unit @size_unit end |
#stroke ⇒ Object
Returns the value of attribute stroke
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def stroke @stroke end |
#stroke_width ⇒ Object
Returns the value of attribute stroke_width
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def stroke_width @stroke_width end |
#tagged_values ⇒ Object
Returns the value of attribute tagged_values
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def tagged_values @tagged_values end |
#text_fill ⇒ Object
Returns the value of attribute text_fill
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def text_fill @text_fill end |
#theme ⇒ Object
Returns the value of attribute theme
14 15 16 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 14 def theme @theme end |
Instance Method Details
#content_below_header? ⇒ Boolean
Compartments below the header that produce a divider when any of them has content. Returns true when at least one is non-empty.
43 44 45 46 47 48 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 43 def content_below_header? !attr_lines.empty? || !op_lines.empty? || enum_literals.any? || tagged_values.any? || (constraints&.any?) || (!package_content_lines.nil? && !package_content_lines.empty?) end |
#model_index_for(id) ⇒ Object
Resolve a model element by id via the threaded model index. Returns nil when no index is wired in or the id is absent.
34 35 36 37 38 |
# File 'lib/ea/svg/ea_emitter/render_context.rb', line 34 def model_index_for(id) return nil unless model_index && id model_index[id] end |