Module: Yard::Yaml::Templates

Defined in:
lib/yard/yaml/templates.rb

Class Method Summary collapse

Class Method Details

.register! ⇒ Object

Register the templates path with YARD if available. Idempotent and safe when YARD is not loaded.



19
20
21
22
23
24
25
26
27
# File 'lib/yard/yaml/templates.rb', line 19

def register!
  return unless defined?(::YARD) && ::YARD.const_defined?(:Templates)
  base = File.expand_path("../../../templates", __dir__)
  begin
    ::YARD::Templates::Engine.register_template_path(base)
  rescue
    # ignore if engine not available or already registered
  end
end