class YARD::Server::Commands::Base

This is the base command class used to implement custom commands for a server. A command will be routed to by the {Router} class and return a Rack-style response.

Attribute Initializers

All attributes can be initialized via options passed into the {#initialize} method. When creating a custom command, the {Adapter#options} will automatically be mapped to attributes by the same name on your class.

class MyCommand < Base
  attr_accessor :myattr
end

Adapter.new(libs, {:myattr => 'foo'}).start

# when a request comes in, cmd.myattr == 'foo'

Subclassing Notes

To implement a custom command, override the {#run} method, not {#call}. In your implementation, you should set the body and status for requests. See details in the #run method documentation.

Note that if your command deals directly with libraries, you should consider subclassing the more specific {LibraryCommand} class instead.

@abstract @see run