Class: YARD::Server::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/yard/server/adapter.rb

Class Method Summary collapse

Class Method Details

.setupObject

To provide the templates necessary for ‘yard-gherkin-turnip` to integrate with YARD the adapter has to around-alias the setup method to place the `yard-gherkin-turnip` server templates as the last template in the list.

When they are normally loaded with the plugin they cause an error with the ‘yardoc` command. They are also not used because the YARD server templates are placed after all plugin templates.



19
20
21
22
23
# File 'lib/yard/server/adapter.rb', line 19

def setup
  yard_setup
  YARD::Templates::Engine.template_paths +=
  [File.dirname(__FILE__) + '/../../templates',File.dirname(__FILE__) + '/../../docserver']
end

.shutdownObject

Similar to the addition, it is good business to tear down the templates that were added by again around-aliasing the shutdown method.



31
32
33
34
35
# File 'lib/yard/server/adapter.rb', line 31

def shutdown
  yard_shutdown
  YARD::Templates::Engine.template_paths -=
  [File.dirname(__FILE__) + '/../../templates',File.dirname(__FILE__) + '/../../docserver']
end

.yard_setupObject



8
# File 'lib/yard/server/adapter.rb', line 8

alias_method :yard_setup, :setup

.yard_shutdownObject



25
# File 'lib/yard/server/adapter.rb', line 25

alias_method :yard_shutdown, :shutdown