Class: Pennyworth::Presenters::Gem
- Inherits:
-
Object
- Object
- Pennyworth::Presenters::Gem
- Defined in:
- lib/pennyworth/presenters/gem.rb
Overview
Shapes a RubyGems record for serialization.
Instance Method Summary collapse
- #downloads ⇒ Object
- #id ⇒ Object
-
#initialize(record, inflector: Inflector.new) ⇒ Gem
constructor
A new instance of Gem.
- #issues_url ⇒ Object
- #label ⇒ Object
- #licenses ⇒ Object
- #site_url ⇒ Object
- #source_url ⇒ Object
- #subtitle ⇒ Object
- #updated_at ⇒ Object
- #version ⇒ Object
- #versions_url ⇒ Object
Constructor Details
Instance Method Details
#downloads ⇒ Object
27 |
# File 'lib/pennyworth/presenters/gem.rb', line 27 def downloads = record.fetch(__method__) |
#id ⇒ Object
17 |
# File 'lib/pennyworth/presenters/gem.rb', line 17 def id = record.fetch(:name) |
#issues_url ⇒ Object
33 |
# File 'lib/pennyworth/presenters/gem.rb', line 33 def issues_url = record.fetch(:bug_tracker_uri) |
#label ⇒ Object
19 |
# File 'lib/pennyworth/presenters/gem.rb', line 19 def label = "#{inflector.call id.titleize} #{version}" |
#licenses ⇒ Object
25 |
# File 'lib/pennyworth/presenters/gem.rb', line 25 def licenses = Array(record.fetch(__method__)).to_sentence |
#site_url ⇒ Object
29 |
# File 'lib/pennyworth/presenters/gem.rb', line 29 def site_url = record.fetch(:homepage_uri) |
#source_url ⇒ Object
31 |
# File 'lib/pennyworth/presenters/gem.rb', line 31 def source_url = record.fetch(:source_code_uri) |
#subtitle ⇒ Object
21 |
# File 'lib/pennyworth/presenters/gem.rb', line 21 def subtitle = "Downloads: #{downloads}. Licenses: #{licenses}. Updated: #{updated_at[..9]}." |
#updated_at ⇒ Object
37 |
# File 'lib/pennyworth/presenters/gem.rb', line 37 def updated_at = record.fetch(:version_created_at) |
#version ⇒ Object
23 |
# File 'lib/pennyworth/presenters/gem.rb', line 23 def version = record.fetch(__method__) |
#versions_url ⇒ Object
35 |
# File 'lib/pennyworth/presenters/gem.rb', line 35 def versions_url = record.fetch(:changelog_uri) |