Sha256: 43553e827ff4da2ea8a568ce5928a729f5d55f15be216bd2a2aee88fcc7a38c3

Contents?: true

Size: 767 Bytes

Versions: 11

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

require "refinements/string"

module Pennyworth
  module Presenters
    # Renders a GitHub repository record into a compatible format for use in Alfred script filters.
    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

11 entries across 11 versions & 1 rubygems

Version Path
pennyworth-17.3.0 lib/pennyworth/presenters/repository.rb
pennyworth-17.2.0 lib/pennyworth/presenters/repository.rb
pennyworth-17.1.0 lib/pennyworth/presenters/repository.rb
pennyworth-17.0.0 lib/pennyworth/presenters/repository.rb
pennyworth-16.7.0 lib/pennyworth/presenters/repository.rb
pennyworth-16.5.0 lib/pennyworth/presenters/repository.rb
pennyworth-16.4.0 lib/pennyworth/presenters/repository.rb
pennyworth-16.3.0 lib/pennyworth/presenters/repository.rb
pennyworth-16.2.0 lib/pennyworth/presenters/repository.rb
pennyworth-16.1.0 lib/pennyworth/presenters/repository.rb
pennyworth-16.0.0 lib/pennyworth/presenters/repository.rb