Sha256: 6fb032759182a40acbf0429b25dba54d756a7131b72470f30a247336913252f1

Contents?: true

Size: 833 Bytes

Versions: 6

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  module Serializers
    module System
      # Serializes a system signal presenter for parsing by Alfred script filters.
      class Signal
        def initialize presenter
          @presenter = presenter
        end

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

        private

        attr_reader :presenter

        def id = presenter.id

        def label = presenter.label

        def modifications
          {
            alt: {subtitle: "Copy ID.", arg: id},
            cmd: {subtitle: "Copy ID and name.", arg: "#{id}, #{label}"}
          }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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