Class: YARD::Server::DocServerSerializer
- Inherits:
-
YARD::Serializers::FileSystemSerializer
- Object
- YARD::Serializers::Base
- YARD::Serializers::FileSystemSerializer
- YARD::Server::DocServerSerializer
- Defined in:
- lib/yard/server/doc_server_serializer.rb
Overview
A custom serializer which returns resource URLs instead of static relative paths to files on disk.
Instance Attribute Summary
Attributes inherited from YARD::Serializers::FileSystemSerializer
Attributes inherited from YARD::Serializers::Base
Instance Method Summary collapse
-
#initialize(_command = nil) ⇒ DocServerSerializer
constructor
A new instance of DocServerSerializer.
- #serialized_path(object) ⇒ Object
Methods inherited from YARD::Serializers::FileSystemSerializer
Methods inherited from YARD::Serializers::Base
#after_serialize, #before_serialize, #exists?, #serialize
Constructor Details
#initialize(_command = nil) ⇒ DocServerSerializer
Returns a new instance of DocServerSerializer.
7 8 9 |
# File 'lib/yard/server/doc_server_serializer.rb', line 7 def initialize(_command = nil) super(:basepath => '', :extension => '') end |
Instance Method Details
#serialized_path(object) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/yard/server/doc_server_serializer.rb', line 11 def serialized_path(object) case object when CodeObjects::RootObject "toplevel" when CodeObjects::ExtendedMethodObject serialized_path(object.namespace) + ':' + urlencode(object.name.to_s) when CodeObjects::MethodObject serialized_path(object.namespace) + (object.scope == :instance ? ":" : ".") + urlencode(object.name.to_s) when CodeObjects::ConstantObject, CodeObjects::ClassVariableObject serialized_path(object.namespace) + "##{object.name}-#{object.type}" when CodeObjects::ExtraFileObject super(object).gsub(/^file\./, 'file/') else super(object) end end |