Class: YARD::Server::Commands::DisplayObjectCommand

Inherits:
LibraryCommand show all
Defined in:
lib/yard/server/commands/display_object_command.rb

Overview

Since:

  • 0.6.0

Direct Known Subclasses

FramesCommand

Instance Attribute Summary

Attributes inherited from LibraryCommand

#incremental, #library, #options, #serializer, #single_library

Attributes inherited from Base

#adapter, #body, #caching, #command_options, #headers, #path, #request, #status

Instance Method Summary collapse

Methods inherited from LibraryCommand

#call, #initialize

Methods inherited from Base

#cache, #call, #initialize, #redirect, #render

Constructor Details

This class inherits a constructor from YARD::Server::Commands::LibraryCommand

Instance Method Details

#indexObject

Since:

  • 0.6.0



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/yard/server/commands/display_object_command.rb', line 16

def index
  Registry.load_all

  title = options[:title]
  unless title
    title = "Documentation for #{library.name} #{library.version ? '(' + library.version + ')' : ''}"
  end
  options.update(
    :object => '_index.html',
    :objects => Registry.all(:module, :class),
    :title => title,
    :type => :layout
  )
  render
end

#not_foundObject

Since:

  • 0.6.0



32
33
34
35
# File 'lib/yard/server/commands/display_object_command.rb', line 32

def not_found
  super
  self.body = "Could not find object: #{object_path}"
end

#runObject

Since:

  • 0.6.0



5
6
7
8
9
10
11
12
13
14
# File 'lib/yard/server/commands/display_object_command.rb', line 5

def run
  return index if path.empty?
  
  if object = Registry.at(object_path)
    options.update(:type => :layout)
    render(object)
  else
    self.status = 404
  end
end