Class: Pennyworth::Presenters::Repository
- Inherits:
-
Object
- Object
- Pennyworth::Presenters::Repository
- Defined in:
- lib/pennyworth/presenters/repository.rb
Overview
Shapes a repository record for serialization.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(record, inflector: Inflector.new) ⇒ Repository
constructor
A new instance of Repository.
- #issues_url ⇒ Object
- #label ⇒ Object
- #site_url ⇒ Object
- #source_url ⇒ Object
- #subtitle ⇒ Object
- #versions_url ⇒ Object
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
#id ⇒ Object
16 |
# File 'lib/pennyworth/presenters/repository.rb', line 16 def id = record.fetch(:name) |
#issues_url ⇒ Object
26 |
# File 'lib/pennyworth/presenters/repository.rb', line 26 def issues_url = "#{source_url}/issues" |
#label ⇒ Object
18 |
# File 'lib/pennyworth/presenters/repository.rb', line 18 def label = inflector.call(id.titleize) |
#site_url ⇒ Object
22 |
# File 'lib/pennyworth/presenters/repository.rb', line 22 def site_url = record.fetch(:homepage) |
#source_url ⇒ Object
24 |
# File 'lib/pennyworth/presenters/repository.rb', line 24 def source_url = record.fetch(:html_url) |
#subtitle ⇒ Object
20 |
# File 'lib/pennyworth/presenters/repository.rb', line 20 def subtitle = record.fetch(:description) |
#versions_url ⇒ Object
28 |
# File 'lib/pennyworth/presenters/repository.rb', line 28 def versions_url = "#{site_url}/versions" |