Sha256: 45cdb9cd6b758c1be1eb82eabeb9c0be47dd60d0afdfc1eee2a9c9ff4671f2d8

Contents?: true

Size: 719 Bytes

Versions: 6

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true

require "refinements/string"

module Pennyworth
  module Presenters
    # Shapes a repository record for serialization.
    class Repository
      using Refinements::String

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

      def id = record.fetch(:name)

      def label = inflector.call(id.titleize)

      def subtitle = record.fetch(:description)

      def site_url = record.fetch(:homepage)

      def source_url = record.fetch(:html_url)

      def issues_url = "#{source_url}/issues"

      def versions_url = "#{site_url}/versions"

      private

      attr_reader :record, :inflector
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pennyworth-17.8.0 lib/pennyworth/presenters/repository.rb
pennyworth-17.7.0 lib/pennyworth/presenters/repository.rb
pennyworth-17.6.0 lib/pennyworth/presenters/repository.rb
pennyworth-17.5.0 lib/pennyworth/presenters/repository.rb
pennyworth-17.4.1 lib/pennyworth/presenters/repository.rb
pennyworth-17.4.0 lib/pennyworth/presenters/repository.rb