Sha256: fc4ab98753fc61d2ba7fc7e5d90db0996a1773c3f3ad518d6962d1761487064b

Contents?: true

Size: 1.08 KB

Versions: 48

Compression:

Stored size: 1.08 KB

Contents

require 'webrick/httputils'

module YARD
  module Server
    # A custom {Serializers::Base serializer} which returns resource URLs instead of
    # static relative paths to files on disk.
    class DocServerSerializer < Serializers::FileSystemSerializer
      include WEBrick::HTTPUtils

      def initialize(command = nil)
        super(:basepath => '', :extension => '')
      end

      def serialized_path(object)
        case object
        when CodeObjects::RootObject
          "toplevel"
        when CodeObjects::ExtendedMethodObject
          serialized_path(object.namespace) + ':' + escape(object.name.to_s)
        when CodeObjects::MethodObject
          serialized_path(object.namespace) +
            (object.scope == :instance ? ":" : ".") + escape(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
    end
  end
end

Version data entries

48 entries across 35 versions & 5 rubygems

Version Path
yard-0.8.7.2 lib/yard/server/doc_server_serializer.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/yard-0.8.7/lib/yard/server/doc_server_serializer.rb
candlepin-api-0.4.0 bundle/ruby/gems/yard-0.8.7/lib/yard/server/doc_server_serializer.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/yard-0.8.7/lib/yard/server/doc_server_serializer.rb
yard-0.8.7.1 lib/yard/server/doc_server_serializer.rb
yard-0.8.7 lib/yard/server/doc_server_serializer.rb
challah-1.0.0 vendor/bundle/gems/yard-0.8.6.1/lib/yard/server/doc_server_serializer.rb
yard-0.8.6.2 lib/yard/server/doc_server_serializer.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.6.1/lib/yard/server/doc_server_serializer.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.5.2/lib/yard/server/doc_server_serializer.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.6/lib/yard/server/doc_server_serializer.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/yard-0.8.6.1/lib/yard/server/doc_server_serializer.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/yard-0.8.6.1/lib/yard/server/doc_server_serializer.rb
yard-0.8.6.1 lib/yard/server/doc_server_serializer.rb
challah-1.0.0.beta2 vendor/bundle/gems/yard-0.8.5.2/lib/yard/server/doc_server_serializer.rb
challah-1.0.0.beta2 vendor/bundle/gems/yard-0.8.6/lib/yard/server/doc_server_serializer.rb
yard-0.8.6 lib/yard/server/doc_server_serializer.rb
challah-1.0.0.beta vendor/bundle/gems/yard-0.8.3/lib/yard/server/doc_server_serializer.rb
challah-1.0.0.beta vendor/bundle/gems/yard-0.8.5.2/lib/yard/server/doc_server_serializer.rb
yard-0.8.5.2 lib/yard/server/doc_server_serializer.rb