Sha256: 00608e16fd8d68ffe72289fd2ae90977ae508cd1d873553612edcc5f7fe54cd5

Contents?: true

Size: 563 Bytes

Versions: 11

Compression:

Stored size: 563 Bytes

Contents

# frozen_string_literal: true

require "refinements/array"

module Pennyworth
  module Presenters
    # Renders a standard error into a compatible format for use in Alfred script filters.
    class StandardError
      using Refinements::Array

      def initialize record
        @record = record
      end

      def id = label

      def label = record.name.to_s

      def path = file_path.empty? ? "" : [file_path, record.line_number].compress.join(":")

      private

      attr_reader :record

      def file_path = record.file_path.to_s
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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