Class: Packages::Pypi::PackagePresenter

Inherits:
Object
  • Object
show all
Includes:
API::Helpers::RelatedResourcesHelpers
Defined in:
app/presenters/packages/pypi/package_presenter.rb

Instance Method Summary collapse

Methods included from API::Helpers::RelatedResourcesHelpers

#expose_path, #expose_url, #issues_available?, #mrs_available?

Constructor Details

#initialize(packages, project) ⇒ PackagePresenter

Returns a new instance of PackagePresenter.


10
11
12
13
# File 'app/presenters/packages/pypi/package_presenter.rb', line 10

def initialize(packages, project)
  @packages = packages
  @project = project
end

Instance Method Details

#bodyObject

Returns the HTML body for PyPi simple API. Basically a list of package download links for a specific package


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/presenters/packages/pypi/package_presenter.rb', line 18

def body
  <<-HTML
  <!DOCTYPE html>
  <html>
    <head>
      <title>Links for #{escape(name)}</title>
    </head>
    <body>
      <h1>Links for #{escape(name)}</h1>
      #{links}
    </body>
  </html>
  HTML
end