Sha256: afe05f0971dea5a7cc97dab7182e3d590dc4ee20813c577b201d8ec17c7d5888
Contents?: true
Size: 1.17 KB
Versions: 16
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module Hanami module CLI # @since 2.0.0 # @api private class Server # @since 2.0.0 # @api private attr_reader :rack_server # @since 2.0.0 # @api private RACK_FALLBACK_OPTIONS = { host: :Host, port: :Port }.freeze # @since 2.0.0 # @api private OVERRIDING_OPTIONS = { config: :config, debug: :debug, warn: :warn }.freeze # @since 2.0.0 # @api private def initialize(rack_server: Rack::Server) @rack_server = rack_server end # @since 2.0.0 # @api private def call(**options) rack_server.start(Hash[ extract_rack_fallback_options(options) + extract_overriding_options(options) ]) end private def extract_rack_fallback_options(options) RACK_FALLBACK_OPTIONS.filter_map do |(name, rack_name)| options[name] && [rack_name, options[name]] end end def extract_overriding_options(options) OVERRIDING_OPTIONS.map do |(name, rack_name)| [rack_name, options[name]] end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems