lib/asciidoctor/doctest/asciidoc_renderer.rb in asciidoctor-doctest-1.5.1 vs lib/asciidoctor/doctest/asciidoc_renderer.rb in asciidoctor-doctest-1.5.1.1

- old
+ new

@@ -1,6 +1,7 @@ require 'active_support/core_ext/array/wrap' +require 'active_support/core_ext/object/blank' require 'asciidoctor' require 'asciidoctor/converter/template' module Asciidoctor module DocTest @@ -10,11 +11,11 @@ class AsciidocRenderer attr_reader :backend_name, :converter, :template_dirs ## - # @param backend_name [#to_s] the name of the tested backend. + # @param backend_name [#to_s, nil] the name of the tested backend. # # @param converter [Class, Asciidoctor::Converter::Base, nil] # the backend's converter class (or its instance). If not # specified, the default converter for the specified backend will # be used. @@ -31,13 +32,13 @@ # by default. # # @raise [ArgumentError] if some path from the +template_dirs+ doesn't # exist or is not a directory. # - def initialize(backend_name: '', converter: nil, template_dirs: [], + def initialize(backend_name: nil, converter: nil, template_dirs: [], templates_fallback: false) - @backend_name = backend_name.freeze + @backend_name = backend_name.to_s.freeze.presence @converter = converter @converter ||= NoFallbackTemplateConverter unless template_dirs.empty? || templates_fallback template_dirs = Array.wrap(template_dirs).freeze template_dirs.each do |path|