Sha256: 852ab106fa1b55b22c43a71511dcc86b52272e66fbaf321c4dbe5bff7921a685

Contents?: true

Size: 752 Bytes

Versions: 11

Compression:

Stored size: 752 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::Array

      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

11 entries across 11 versions & 1 rubygems

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