module Asciidoctor::SyntaxHighlighter::DefaultFactory

Constants

PROVIDED

Private Instance Methods

for(name) click to toggle source

This method will lazy require and register additional built-in implementations, which include coderay, pygments, rouge, and prettify. Refer to {Factory#for} for parameters and return value.

# File lib/asciidoctor/syntax_highlighter.rb, line 195
def for name
  @@registry.fetch name do
    @@mutex.synchronize do
      @@registry.fetch name do
        if (require_path = PROVIDED[name])
          require require_path
          @@registry[name]
        else
          @@registry = @@registry.merge name => nil
          nil
        end
      end
    end
  end
end
register(syntax_highlighter, *names) click to toggle source
# File lib/asciidoctor/syntax_highlighter.rb, line 188
def register syntax_highlighter, *names
  @@mutex.owned? ? names.each {|name| @@registry = @@registry.merge name => syntax_highlighter } :
      @@mutex.synchronize { register syntax_highlighter, *names }
end
registry() click to toggle source
# File lib/asciidoctor/syntax_highlighter.rb, line 181
def registry
  @@registry
end