Sha256: 865ea696fb6fa355dd78b21c1e3ce7450a8377486dd19a3f7553fbba664bfc4d
Contents?: true
Size: 923 Bytes
Versions: 11
Compression:
Stored size: 923 Bytes
Contents
# frozen_string_literal: true require "forwardable" require "refinements/string" module Pennyworth module Presenters # Renders system error into a compatible format for use in Alfred script filters. class HTTPStatus extend Forwardable using Refinements::String delegate %i[code label url] => :record def initialize record, inflector: Inflector.new @record = record @inflector = inflector end def id = record.code def subtitle = "#{id} #{label}" def symbol = ":#{inflector.call name}" private attr_reader :record, :inflector def name label.snakecase .tr("/", "_") .gsub(/(\(|\))/, "") .sub("h_t_t_p_version_not_supported", "http_version_not_supported") .sub("i_m_used", "im_used") .sub("u_r_i_too_long", "uri_too_long") end end end end
Version data entries
11 entries across 11 versions & 1 rubygems