lib/yard/templates/engine.rb in yard-0.9.5 vs lib/yard/templates/engine.rb in yard-0.9.6
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
require 'ostruct'
module YARD
module Templates
# This module manages all creation, handling and rendering of {Template}
@@ -51,11 +52,11 @@
# @return [Template] the template module representing the +path+
def template!(path, full_paths = nil)
full_paths ||= [path]
full_paths = [full_paths] unless full_paths.is_a?(Array)
name = template_module_name(full_paths.first)
- begin; return const_get(name); rescue NameError; end
+ begin; return const_get(name); rescue NameError; nil end
mod = const_set(name, Module.new)
mod.send(:include, Template)
mod.send(:initialize, path, full_paths)
mod
@@ -109,10 +110,10 @@
# @param [CodeObjects::Base] object the code object to serialize
# @param [Serializers::Base] serializer the serializer object
# @yield a block whose result will be serialize
# @yieldreturn [String] the contents to serialize
# @see Serializers::Base
- def with_serializer(object, serializer, &block)
+ def with_serializer(object, serializer)
output = nil
filename = serializer.serialized_path(object)
if serializer.respond_to?(:basepath)
filename = File.join(serializer.basepath, filename)
end