Sha256: 89cf5054d0bf8dfab93613557c8b43cd14c37f2f9cca0f79d30e72b5e1c994f0

Contents?: true

Size: 646 Bytes

Versions: 4

Compression:

Stored size: 646 Bytes

Contents

module YARD
  module Server
    module Commands
      class DisplayFileCommand < LibraryCommand
        def run
          ppath = library.source_path
          filename = File.cleanpath(File.join(library.source_path, path))
          raise NotFoundError if !File.file?(filename)
          if filename =~ /\.(jpe?g|gif|png|bmp)$/i
            headers['Content-Type'] = StaticFileCommand::DefaultMimeTypes[$1.downcase] || 'text/html'
            render IO.read(filename)
          else
            options.update(:object => Registry.root, :type => :layout, :file => filename)
            render
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yard-0.6.3 lib/yard/server/commands/display_file_command.rb
yard-0.6.2 lib/yard/server/commands/display_file_command.rb
yard-0.6.1 lib/yard/server/commands/display_file_command.rb
yard-0.6.0 lib/yard/server/commands/display_file_command.rb