Class: YARD::Server::Commands::LibraryCommand Abstract

Inherits:
Base
  • Object
show all
Defined in:
lib/yard/server/commands/library_command.rb

Overview

This class is abstract.

This is the base command for all commands that deal directly with libraries. Some commands do not, but most (like DisplayObjectCommand) do. If your command deals with libraries directly, subclass this class instead. See Base for notes on how to subclass a command.

Since:

  • 0.6.0

Constant Summary collapse

@@library_chdir_lock =

Needed to synchronize threads in #setup_yardopts

Since:

  • 0.6.0

Mutex.new

Instance Attribute Summary collapse

Attributes inherited from Base

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

Instance Method Summary collapse

Methods inherited from Base

#run

Constructor Details

#initialize(opts = {}) ⇒ LibraryCommand

Returns a new instance of LibraryCommand.

Since:

  • 0.6.0



63
64
65
66
# File 'lib/yard/server/commands/library_command.rb', line 63

def initialize(opts = {})
  super
  self.serializer = DocServerSerializer.new
end

Instance Attribute Details

#incrementalBoolean

Returns whether to reparse data.

Returns:

  • (Boolean)

    whether to reparse data

Since:

  • 0.6.0



53
54
55
# File 'lib/yard/server/commands/library_command.rb', line 53

def incremental
  @incremental
end

#libraryLibraryVersion

Returns the object containing library information.

Returns:

Since:

  • 0.6.0



41
42
43
# File 'lib/yard/server/commands/library_command.rb', line 41

def library
  @library
end

#optionsLibraryOptions

Returns default options for the library.

Returns:

Since:

  • 0.6.0



44
45
46
# File 'lib/yard/server/commands/library_command.rb', line 44

def options
  @options
end

#serializerSerializers::Base

Returns the serializer used to perform file linking.

Returns:

Since:

  • 0.6.0



47
48
49
# File 'lib/yard/server/commands/library_command.rb', line 47

def serializer
  @serializer
end

#single_libraryBoolean

Returns whether router should route for multiple libraries.

Returns:

  • (Boolean)

    whether router should route for multiple libraries

Since:

  • 0.6.0



50
51
52
# File 'lib/yard/server/commands/library_command.rb', line 50

def single_library
  @single_library
end

#use_forkBoolean

Returns whether or not this adapter calls fork when serving library requests. Defaults to false.

Returns:

  • (Boolean)

    whether or not this adapter calls fork when serving library requests. Defaults to false.

Since:

  • 0.6.0



57
58
59
# File 'lib/yard/server/commands/library_command.rb', line 57

def use_fork
  @use_fork
end

Instance Method Details

#call(request) ⇒ Object

Since:

  • 0.6.0



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/yard/server/commands/library_command.rb', line 68

def call(request)
  if can_fork?
    call_with_fork(request) { super }
  else
    begin
      save_default_template_info
      call_without_fork(request) { super }
    ensure
      restore_template_info
    end
  end
end