Sha256: 19b21243f390a52653e467a696ec7b578e3e0e567af4f802e7d68cd1dfd81a31

Contents?: true

Size: 769 Bytes

Versions: 17

Compression:

Stored size: 769 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 issues_url = "#{source_url}/issues"

      def versions_url = "#{site_url}/versions"

      private

      attr_reader :record, :inflector
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pennyworth-15.4.1 lib/pennyworth/presenters/repository.rb
pennyworth-15.4.0 lib/pennyworth/presenters/repository.rb
pennyworth-15.3.0 lib/pennyworth/presenters/repository.rb
pennyworth-15.2.0 lib/pennyworth/presenters/repository.rb
pennyworth-15.1.1 lib/pennyworth/presenters/repository.rb
pennyworth-15.1.0 lib/pennyworth/presenters/repository.rb
pennyworth-15.0.3 lib/pennyworth/presenters/repository.rb
pennyworth-15.0.2 lib/pennyworth/presenters/repository.rb
pennyworth-15.0.1 lib/pennyworth/presenters/repository.rb
pennyworth-15.0.0 lib/pennyworth/presenters/repository.rb
pennyworth-14.3.0 lib/pennyworth/presenters/repository.rb
pennyworth-14.2.1 lib/pennyworth/presenters/repository.rb
pennyworth-14.2.0 lib/pennyworth/presenters/repository.rb
pennyworth-14.1.2 lib/pennyworth/presenters/repository.rb
pennyworth-14.1.1 lib/pennyworth/presenters/repository.rb
pennyworth-14.1.0 lib/pennyworth/presenters/repository.rb
pennyworth-14.0.0 lib/pennyworth/presenters/repository.rb