Module: Metanorma::Compile::Flavor

Included in:
Metanorma::Compile
Defined in:
lib/metanorma/compile/flavor.rb

Instance Method Summary collapse

Instance Method Details

#load_flavor(stdtype) ⇒ void

This method returns an undefined value.

Load the flavor gem for the given standard type

Parameters:

  • stdtype (Symbol)

    the standard type



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/metanorma/compile/flavor.rb', line 9

def load_flavor(stdtype)
  stdtype = stdtype.to_sym
  flavor = stdtype2flavor(stdtype)
  @registry.supported_backends.include? stdtype or
    Util.log("[metanorma] Info: Loading `#{flavor}` gem "\
             "for standard type `#{stdtype}`.", :info)
  require_flavor(flavor)
  @registry.supported_backends.include? stdtype or
    Util.log("[metanorma] Error: The `#{flavor}` gem does not "\
             "support the standard type #{stdtype}. Exiting.", :fatal)
end

#stdtype2flavor(stdtype) ⇒ String

Convert the standard type to the flavor gem name

Parameters:

  • stdtype (Symbol)

    the standard type

Returns:

  • (String)

    the flavor gem name



24
25
26
27
# File 'lib/metanorma/compile/flavor.rb', line 24

def stdtype2flavor(stdtype)
  flavor = STDTYPE2FLAVOR[stdtype] || stdtype
  "metanorma-#{flavor}"
end