Class: Pennyworth::Serializers::Encoding

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

Overview

Serializes an encoding presenter for parsing by Alfred script filters.

Instance Method Summary collapse

Constructor Details

#initialize(presenter) ⇒ Encoding

Returns a new instance of Encoding.



9
10
11
# File 'lib/pennyworth/serializers/encoding.rb', line 9

def initialize presenter
  @presenter = presenter
end

Instance Method Details

#to_hObject



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

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