Sha256: 4f1e4fc6da3d31333e661a4d9720e18d190b92bc8a04a7177664eb33cc5c9b90
Contents?: true
Size: 1.07 KB
Versions: 17
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require "refinements/strings" module Pennyworth module Presenters # Renders RubyGems records into a compatible format for use in Alfred script filters. class Gem using Refinements::Arrays 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} #{version}" def subtitle = "Downloads: #{downloads}. Licenses: #{licenses}. Updated: #{updated_at[..9]}." def version = record.fetch(__method__) def licenses = Array(record.fetch(__method__)).to_sentence def downloads = record.fetch(__method__) def site_url = record.fetch(:homepage_uri) def source_url = record.fetch(:source_code_uri) def issues_url = record.fetch(:bug_tracker_uri) def versions_url = record.fetch(:changelog_uri) def updated_at = record.fetch(:version_created_at) private attr_reader :record, :inflector end end end
Version data entries
17 entries across 17 versions & 1 rubygems