Sha256: 72a15c561fe3b031c7116275cd99f3c767c107e157518ca8b2fc40b574bda04d
Contents?: true
Size: 1.25 KB
Versions: 11
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true require 'rack/capture' module Weneedfeed class Capture class << self # @param [String] base_url # @param [String] schema_path def call( base_url:, schema_path: ) new( base_url: base_url, schema_path: schema_path ).call end end # @param [String] base_url # @param [String] schema_path def initialize( base_url:, schema_path: ) @base_url = base_url @schema_path = schema_path end def call urls.each do |url| ::Rack::Capture.call( app: app, script_name: script_name, url: url ) end end private # @return [Weneedfeed::Application] def app @app ||= ::Weneedfeed::Application.new( schema_path: @schema_path ) end # @return [URI] def base_uri @base_uri ||= ::URI.parse(@base_url) end # @return [String] def script_name case base_uri.path when '', '/' '' else base_uri.path end end # @return [Array<String>] def urls app.paths.map do |path| [ @base_url, path ].join end end end end
Version data entries
11 entries across 11 versions & 1 rubygems