Sha256: 625ea49113f66312c6b8aed488ae84b8b4bed9d00c9c5f84d465bd855d516fd3

Contents?: true

Size: 772 Bytes

Versions: 11

Compression:

Stored size: 772 Bytes

Contents

# frozen_string_literal: true

require "refinements/strings"

module Pennyworth
  module Presenters
    # Renders a GitHub repository record into a compatible format for use in Alfred script filters.
    class Repository
      using Refinements::Strings

      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 changes_url = "#{site_url}/changes.html"

      def issues_url = "#{source_url}/issues"

      private

      attr_reader :record, :inflector
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pennyworth-12.0.1 lib/pennyworth/presenters/repository.rb
pennyworth-12.0.0 lib/pennyworth/presenters/repository.rb
pennyworth-11.2.2 lib/pennyworth/presenters/repository.rb
pennyworth-11.2.1 lib/pennyworth/presenters/repository.rb
pennyworth-11.2.0 lib/pennyworth/presenters/repository.rb
pennyworth-11.1.3 lib/pennyworth/presenters/repository.rb
pennyworth-11.1.2 lib/pennyworth/presenters/repository.rb
pennyworth-11.1.1 lib/pennyworth/presenters/repository.rb
pennyworth-11.1.0 lib/pennyworth/presenters/repository.rb
pennyworth-11.0.1 lib/pennyworth/presenters/repository.rb
pennyworth-11.0.0 lib/pennyworth/presenters/repository.rb