Class: Pennyworth::Presenters::HTTPStatus

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pennyworth/presenters/http_status.rb

Overview

Shapes a HTTP status record for serialization.

Instance Method Summary collapse

Constructor Details

#initialize(record, inflector: Inflector.new) ⇒ HTTPStatus

Returns a new instance of HTTPStatus.



16
17
18
19
# File 'lib/pennyworth/presenters/http_status.rb', line 16

def initialize record, inflector: Inflector.new
  @record = record
  @inflector = inflector
end

Instance Method Details

#idObject



21
# File 'lib/pennyworth/presenters/http_status.rb', line 21

def id = record.code

#subtitleObject



23
# File 'lib/pennyworth/presenters/http_status.rb', line 23

def subtitle = "#{id} #{label}"

#symbolObject



25
# File 'lib/pennyworth/presenters/http_status.rb', line 25

def symbol = ":#{inflector.call name}"