lib/yard/server/commands/display_object_command.rb in yard-0.9.5 vs lib/yard/server/commands/display_object_command.rb in yard-0.9.6
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
module YARD
module Server
module Commands
# Displays documentation for a specific object identified by the path
class DisplayObjectCommand < LibraryCommand
@@ -9,21 +10,23 @@
if path.empty?
if options.readme
filename = options.readme.filename
opts = adapter.options.merge(
:index => true, :library => library,
- :path => filename.sub(%r{^#{library.source_path.to_s}/}, ''))
+ :path => filename.sub(%r{^#{library.source_path.to_s}/}, '')
+ )
self.status, self.headers, self.body =
*DisplayFileCommand.new(opts).call(request)
- cache(self.body)
+ cache(body)
return
else
self.path = 'index'
end
end
return index if path == 'index'
- if object = Registry.at(object_path)
+ object = Registry.at(object_path)
+ if object
options.update(:type => :layout)
render(object)
else
not_found
end