Class: Pennyworth::Serializers::Text

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

Overview

Serializes a text presenter for parsing by Alfred script filters.

Instance Method Summary collapse

Constructor Details

#initialize(presenter) ⇒ Text

Returns a new instance of Text.



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

def initialize presenter
  @presenter = presenter
end

Instance Method Details

#to_hObject



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

def to_h
  {
    uid: id,
    title: presenter.label,
    subtitle: id.capitalize,
    arg: content,
    icon: {path: "text/#{id}.png"},
    text: {copy: content, largetype: content}
  }
end