Class: Pennyworth::Serializers::Encoding

Inherits:
Object
  • Object
show all
Defined in:
lib/pennyworth/serializers/encoding.rb

Overview

Serializes a encoding into a compatible format for parsing within Alfred script filters.

Instance Method Summary collapse

Constructor Details

#initialize(presenter) ⇒ Encoding

Returns a new instance of Encoding.



7
8
9
# File 'lib/pennyworth/serializers/encoding.rb', line 7

def initialize presenter
  @presenter = presenter
end

Instance Method Details

#to_hObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pennyworth/serializers/encoding.rb', line 11

def to_h
  {
    uid: presenter.id,
    title: label,
    subtitle: %(Aliases: #{aliases}.),
    arg: label,
    mods: {
      alt: {subtitle: "Copy aliases.", arg: aliases}
    },
    text: {copy: label, largetype: label}
  }
end