Sha256: 693be8627edb3f3b20852cff1b3df28b85a053ad7e03101890144845eddae20f

Contents?: true

Size: 806 Bytes

Versions: 6

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

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

      def to_h
        {
          uid: id,
          title: id,
          arg: label,
          mods: modifications,
          text: {copy: label, largetype: label}
        }
      end

      private

      attr_reader :presenter

      def id = presenter.id

      def label = presenter.label

      def description = presenter.description

      def modifications
        {
          control: {subtitle: "Copy label.", arg: label},
          alt: {subtitle: "Copy path.", arg: path}
        }
      end

      def path = presenter.path
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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