Sha256: 746ab1817edf2b4dcd63cb895763d4dd1d6ec27db6e7cfaccd1e335b2a7b9a0b
Contents?: true
Size: 668 Bytes
Versions: 7
Compression:
Stored size: 668 Bytes
Contents
# frozen_string_literal: true require "rack" module Pennyworth module Loaders # Loads an array of HTTP status records. class HTTPStatuses def initialize codes: Rack::Utils::HTTP_STATUS_CODES, model: Models::HTTPStatus, configuration: Configuration::Loader.call @codes = codes @model = model @configuration = configuration end def call _omit = nil codes.map { |(code, label)| model[code:, label:, url: "#{url}/#{code}"] } end private attr_reader :codes, :model, :configuration def url = configuration.http_statuses_url end end end
Version data entries
7 entries across 7 versions & 1 rubygems