Class: YARD::Server::Commands::FramesCommand

Inherits:
DisplayObjectCommand show all
Includes:
DocServerHelper
Defined in:
lib/yard/server/commands/frames_command.rb

Overview

Displays an object wrapped in frames

Since:

  • 0.6.0

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 included from DocServerHelper

#base_path, #router, #url_for, #url_for_file

Methods inherited from DisplayObjectCommand

#index, #not_found

Methods inherited from LibraryCommand

#call, #initialize

Methods inherited from Base

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

Constructor Details

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

Instance Method Details

#runObject

Since:

  • 0.6.0


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/yard/server/commands/frames_command.rb', line 8

def run
  main_url = request.path.gsub(/^(.+)?\/frames(?:\/(#{path}))?$/, '\1/\2')
  if path =~ %r{^file/}
    page_title = "File: #{$'}"
  elsif !path.empty?
    page_title = "Object: #{object_path}"
  elsif options[:files] && options[:files].size > 0
    page_title = "File: #{options[:files].first.sub(/^#{library.source_path}\/?/, '')}"
    main_url = url_for_file(options[:files].first)
  elsif !path || path.empty?
    page_title = "Documentation for #{library.name} #{library.version ? '(' + library.version + ')' : ''}"
  end

  options.update(
    :page_title => page_title,
    :main_url => main_url,
    :template => :doc_server,
    :type => :frames
  )
  render
end