lib/pennyworth/presenters/gem.rb in pennyworth-13.4.0 vs lib/pennyworth/presenters/gem.rb in pennyworth-13.5.0
- old
+ new
@@ -4,30 +4,26 @@
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)
+ def label = "#{inflector.call id.titleize} #{version}"
- def subtitle
- "Version: #{version}. " \
- "Updated: #{updated_at[..9]}. " \
- "Licenses: #{licenses}. " \
- "Downloads: #{downloads}."
- end
+ def subtitle = "Downloads: #{downloads}. Licenses: #{licenses}. Updated: #{updated_at[..9]}."
def version = record.fetch(__method__)
- def licenses = Array(record.fetch(__method__)).join(", ")
+ def licenses = Array(record.fetch(__method__)).to_sentence
def downloads = record.fetch(__method__)
def site_url = record.fetch(:homepage_uri)