Class: Lutaml::Model::Schema::Renderers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/model/schema/renderers/base.rb

Overview

Shared constructor and helpers for the value/namespace renderers (Union, RestrictedType, Namespace). Model has its own constructor because it computes an opt-out (module-wrappable) namespace.

Direct Known Subclasses

Namespace, RestrictedType, Union

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec, indent: 2, module_namespace: nil, register_id: :default) ⇒ Base

Returns a new instance of Base.



17
18
19
20
21
22
23
24
# File 'lib/lutaml/model/schema/renderers/base.rb', line 17

def initialize(spec, indent: 2, module_namespace: nil, register_id: :default)
  @spec = spec
  @indent = indent.is_a?(Integer) ? " " * indent : indent
  @extended_indent = @indent * 2
  @module_namespace = module_namespace
  @modules = module_namespace&.split("::") || []
  @register_id = register_id
end

Class Method Details

.render(spec) ⇒ Object



13
14
15
# File 'lib/lutaml/model/schema/renderers/base.rb', line 13

def self.render(spec, **)
  new(spec, **).render
end