Sha256: 44738a591c38cf358ec05349e6f342b9d1819d09dbee2ad0591e377527fdecba

Contents?: true

Size: 708 Bytes

Versions: 22

Compression:

Stored size: 708 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  module Serializers
    # Serializes a encoding into a compatible format for parsing within Alfred script filters.
    class Encoding
      def initialize presenter
        @presenter = presenter
      end

      def to_h
        {
          uid: presenter.id,
          title: label,
          subtitle: %(Aliases: #{aliases}.),
          arg: label,
          mods: {
            alt: {subtitle: "Copy aliases.", arg: aliases}
          },
          text: {copy: label, largetype: label}
        }
      end

      private

      attr_reader :presenter

      def label = presenter.label

      def aliases = presenter.aliases.join(", ")
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pennyworth-11.0.1 lib/pennyworth/serializers/encoding.rb
pennyworth-11.0.0 lib/pennyworth/serializers/encoding.rb