Class: Pennyworth::Serializers::HTTPStatus

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(presenter) ⇒ HTTPStatus

Returns a new instance of HTTPStatus.



7
8
9
# File 'lib/pennyworth/serializers/http_status.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/http_status.rb', line 11

def to_h
  {
    uid: id,
    title: code,
    subtitle: label,
    arg: presenter.symbol,
    mods: modifications,
    text: {copy: "#{code} #{label}", largetype: "#{code} #{label}"}
  }
end