Class: Pennyworth::Loaders::HTTPStatus

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

Overview

Loads an array of HTTP status records.

Instance Method Summary collapse

Constructor Details

#initialize(codes: Rack::Utils::HTTP_STATUS_CODES, model: Models::HTTPStatus) ⇒ HTTPStatus

Returns a new instance of HTTPStatus.



11
12
13
14
15
# File 'lib/pennyworth/loaders/http_status.rb', line 11

def initialize(codes: Rack::Utils::HTTP_STATUS_CODES, model: Models::HTTPStatus, **)
  super(**)
  @codes = codes
  @model = model
end

Instance Method Details

#callObject



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

def call(*)
  codes.map { |(code, label)| model[code:, label:, url: "#{url}/#{code}"] }
end