Module: JekyllOpenAPI::JekyllPlugin

Defined in:
lib/jekyll_openapi/jekyll_plugin.rb

Overview

Jekyll integration: registers the Liquid filters and routes warnings to Jekyll's logger. Loaded automatically when the gem is required inside a Jekyll site (see lib/jekyll-openapi.rb); kept separate so the core library stays usable and testable without Jekyll.

Defined Under Namespace

Classes: LoggerAdapter

Class Method Summary collapse

Class Method Details

.registerObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jekyll_openapi/jekyll_plugin.rb', line 16

def self.register
  JekyllOpenAPI.logger = LoggerAdapter.new
  # Liquid 5.x moved filter registration onto the Environment; the
  # Template method still works but warns. Fall back to it on Liquid 4.x,
  # which has no Environment.
  if defined?(::Liquid::Environment)
    ::Liquid::Environment.default.register_filter(JekyllOpenAPI::Filters)
  else
    ::Liquid::Template.register_filter(JekyllOpenAPI::Filters)
  end
end