Class: Pennyworth::Presenters::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/pennyworth/presenters/repository.rb

Overview

Shapes a repository record for serialization.

Instance Method Summary collapse

Constructor Details

#initialize(record, inflector: Inflector.new) ⇒ Repository

Returns a new instance of Repository.



11
12
13
14
# File 'lib/pennyworth/presenters/repository.rb', line 11

def initialize record, inflector: Inflector.new
  @record = record
  @inflector = inflector
end

Instance Method Details

#idObject



16
# File 'lib/pennyworth/presenters/repository.rb', line 16

def id = record.fetch(:name)

#issues_urlObject



26
# File 'lib/pennyworth/presenters/repository.rb', line 26

def issues_url = "#{source_url}/issues"

#labelObject



18
# File 'lib/pennyworth/presenters/repository.rb', line 18

def label = inflector.call(id.titleize)

#site_urlObject



22
# File 'lib/pennyworth/presenters/repository.rb', line 22

def site_url = record.fetch(:homepage)

#source_urlObject



24
# File 'lib/pennyworth/presenters/repository.rb', line 24

def source_url = record.fetch(:html_url)

#subtitleObject



20
# File 'lib/pennyworth/presenters/repository.rb', line 20

def subtitle = record.fetch(:description)

#versions_urlObject



28
# File 'lib/pennyworth/presenters/repository.rb', line 28

def versions_url = "#{site_url}/versions"