Sha256: 249f6dad17088e23e5860eb68d4b3c236e5a2f0186bf8c0b7fe67a8f12bb9ebb

Contents?: true

Size: 825 Bytes

Versions: 35

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  module Serializers
    # Serializes a standard error into a compatible format for parsing within 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

35 entries across 35 versions & 1 rubygems

Version Path
pennyworth-17.3.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-17.2.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-17.1.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-17.0.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-16.7.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-16.5.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-16.4.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-16.3.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-16.2.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-16.1.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-16.0.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.4.1 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.4.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.3.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.2.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.1.1 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.1.0 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.0.3 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.0.2 lib/pennyworth/serializers/standard_error.rb
pennyworth-15.0.1 lib/pennyworth/serializers/standard_error.rb