Class: Lutaml::Xsd::Spa::Svg::ComponentRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/xsd/spa/svg/component_renderer.rb

Overview

Abstract base class for component renderers Subclasses must implement #render method

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, schema_name) ⇒ ComponentRenderer

Returns a new instance of ComponentRenderer.



14
15
16
17
# File 'lib/lutaml/xsd/spa/svg/component_renderer.rb', line 14

def initialize(config, schema_name)
  @config = config
  @schema_name = schema_name
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



12
13
14
# File 'lib/lutaml/xsd/spa/svg/component_renderer.rb', line 12

def config
  @config
end

#schema_nameObject (readonly)

Returns the value of attribute schema_name.



12
13
14
# File 'lib/lutaml/xsd/spa/svg/component_renderer.rb', line 12

def schema_name
  @schema_name
end

Instance Method Details

#render(component_data, box) ⇒ String

Renders a component at the given position

Parameters:

  • component_data (Hash)

    The component data to render

  • box (Geometry::Box)

    The bounding box for the component

Returns:

  • (String)

    SVG markup

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/lutaml/xsd/spa/svg/component_renderer.rb', line 23

def render(component_data, box)
  raise NotImplementedError, "#{self.class} must implement #render"
end