Sha256: 6272e2ddc717e428446ca2c861be9c0615143737b4b76bcb410b891e7d88919e

Contents?: true

Size: 612 Bytes

Versions: 6

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  module Serializers
    # Serializes a text presenter for parsing by Alfred script filters.
    class Text
      def initialize presenter
        @presenter = presenter
      end

      def to_h
        {
          uid: id,
          title: presenter.label,
          subtitle: id.capitalize,
          arg: content,
          icon: {path: "text/#{id}.png"},
          text: {copy: content, largetype: content}
        }
      end

      private

      attr_reader :presenter

      def id = presenter.id

      def content = presenter.content
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pennyworth-17.8.0 lib/pennyworth/serializers/text.rb
pennyworth-17.7.0 lib/pennyworth/serializers/text.rb
pennyworth-17.6.0 lib/pennyworth/serializers/text.rb
pennyworth-17.5.0 lib/pennyworth/serializers/text.rb
pennyworth-17.4.1 lib/pennyworth/serializers/text.rb
pennyworth-17.4.0 lib/pennyworth/serializers/text.rb