Sha256: ba16febb956aebf2173c5256301cebbb3da5439b5e13161de79d9464c184973c
Contents?: true
Size: 802 Bytes
Versions: 12
Compression:
Stored size: 802 Bytes
Contents
# frozen_string_literal: true require "uri" require_relative "errors" module Hanami module CLI # @since 2.0.0 # @api private module URL DEFAULT_URL_PREFIX = "/" private_constant :DEFAULT_URL_PREFIX class << self # @since 2.0.0 # @api private def call(url) result = url result = URI.parse(result).path unless valid?(result) raise InvalidURLError.new(url) end result rescue URI::InvalidURIError raise InvalidURLError.new(url) end alias_method :[], :call # @since 2.0.0 # @api private def valid?(url) return false if url.nil? url.start_with?(DEFAULT_URL_PREFIX) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems