Class: Renderer::Metadata

Inherits:
Object show all
Defined in:
lib/renderer/metadata.rb

Class Method Summary collapse

Class Method Details

.format_authors(authors) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/renderer/metadata.rb', line 5

def self.format_authors(authors)
  return nil if authors.nil? || authors.count.zero?
  return authors.first if authors.length == 1

  others = authors.count - 1
  "#{authors.first}, and #{others} other#{others > 1 ? "s" : ""}"
end


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/renderer/metadata.rb', line 13

def self.project_links(meta)
  links = []
  links << { kind: "rubygems", href: meta[:host_url] } if meta.key?(:host_url) && !meta[:host_url].nil?

  if meta.key? :git_url
    links << if meta[:git_url].index("github.com/")
      { kind: "github", href: meta[:git_url] }
    else
      { kind: "git", href: meta[:git_url] }
    end
  end

  links
end