Method: YARD::Server::Commands::Base#call

Defined in:
lib/yard/server/commands/base.rb

#call(request) ⇒ Array(Number,Hash,Array<String>)

Note:

This command should not be overridden by subclasses. Implement the callback method #run instead.

The main method called by a router with a request object.

Parameters:

  • request (Adapter Dependent)

    the request object

Returns:

  • (Array(Number,Hash,Array<String>))

    a Rack-style response of status, headers, and body wrapped in an array.

Since:

  • 0.6.0

[View source]

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/yard/server/commands/base.rb', line 88

def call(request)
  self.request = request
  self.path ||= request.path[1..-1]
  self.headers = {'Content-Type' => 'text/html'}
  self.body = ''
  self.status = 200
  begin
    run
  rescue FinishRequest
  rescue NotFoundError => e
    self.body = e.message if e.message != e.class.to_s
    self.status = 404
  end
  not_found if status == 404
  [status, headers, body.is_a?(Array) ? body : [body]]
end