Module: Metanorma::Mirror::Output::Formats

Defined in:
lib/metanorma/mirror/output/formats.rb,
lib/metanorma/mirror/output/formats/base_format.rb,
lib/metanorma/mirror/output/formats/inline_format.rb

Defined Under Namespace

Classes: BaseFormat, InlineFormat

Constant Summary collapse

REGISTERED =

All format modules that should be auto-registered. Adding a new format = adding one entry here. No edits to lookup logic.

%i[InlineFormat].freeze

Class Method Summary collapse

Class Method Details

.lookup(name) ⇒ Object

Returns the format class registered under name, or nil. Triggers autoload of all known format modules on first call.



17
18
19
20
# File 'lib/metanorma/mirror/output/formats.rb', line 17

def lookup(name)
  ensure_loaded
  format_map[name]
end

.register(name, format_class) ⇒ Object



27
28
29
30
# File 'lib/metanorma/mirror/output/formats.rb', line 27

def register(name, format_class)
  format_map[name] = format_class
  self
end

.registered?(name) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/metanorma/mirror/output/formats.rb', line 22

def registered?(name)
  ensure_loaded
  format_map.key?(name)
end

.unregister(name) ⇒ Object



32
33
34
35
# File 'lib/metanorma/mirror/output/formats.rb', line 32

def unregister(name)
  format_map.delete(name)
  self
end