Sha256: 40d7b0d2159292cc76842aef73cad046a95106aad10dd98969efc806d638e7ea

Contents?: true

Size: 753 Bytes

Versions: 21

Compression:

Stored size: 753 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
      using Refinements::Arrays

      def initialize presenter
        @presenter = presenter
      end

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

      private

      attr_reader :presenter

      def label = presenter.label

      def aliases = presenter.aliases
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pennyworth-15.4.1 lib/pennyworth/serializers/encoding.rb
pennyworth-15.4.0 lib/pennyworth/serializers/encoding.rb
pennyworth-15.3.0 lib/pennyworth/serializers/encoding.rb
pennyworth-15.2.0 lib/pennyworth/serializers/encoding.rb
pennyworth-15.1.1 lib/pennyworth/serializers/encoding.rb
pennyworth-15.1.0 lib/pennyworth/serializers/encoding.rb
pennyworth-15.0.3 lib/pennyworth/serializers/encoding.rb
pennyworth-15.0.2 lib/pennyworth/serializers/encoding.rb
pennyworth-15.0.1 lib/pennyworth/serializers/encoding.rb
pennyworth-15.0.0 lib/pennyworth/serializers/encoding.rb
pennyworth-14.3.0 lib/pennyworth/serializers/encoding.rb
pennyworth-14.2.1 lib/pennyworth/serializers/encoding.rb
pennyworth-14.2.0 lib/pennyworth/serializers/encoding.rb
pennyworth-14.1.2 lib/pennyworth/serializers/encoding.rb
pennyworth-14.1.1 lib/pennyworth/serializers/encoding.rb
pennyworth-14.1.0 lib/pennyworth/serializers/encoding.rb
pennyworth-14.0.0 lib/pennyworth/serializers/encoding.rb
pennyworth-13.8.0 lib/pennyworth/serializers/encoding.rb
pennyworth-13.7.0 lib/pennyworth/serializers/encoding.rb
pennyworth-13.6.0 lib/pennyworth/serializers/encoding.rb