Sha256: 381d8faa029e06f1760129f262113e4ecf929f79b7a4c41cd2673e2bf30f4fd2
Contents?: true
Size: 568 Bytes
Versions: 10
Compression:
Stored size: 568 Bytes
Contents
# frozen_string_literal: true require "rack" module Pennyworth module Loaders # Loads an array of HTTP status records. class HTTPStatus include Import[:settings] def initialize(codes: Rack::Utils::HTTP_STATUS_CODES, model: Models::HTTPStatus, **) super(**) @codes = codes @model = model end def call(*) codes.map { |(code, label)| model[code:, label:, url: "#{url}/#{code}"] } end private attr_reader :codes, :model def url = settings.http_statuses_url end end end
Version data entries
10 entries across 10 versions & 1 rubygems