<commit_before>module Wheels
  class Cascade

    def initialize(services, application, *spokes)
      unless services.is_a?(Wheels::Container)
        raise ArgumentError.new("Wheels::Cascade#initialize[services] must be a Wheels::Container")
      end

      @services = services
      @applications = []
      @public_paths = []

      @applications << application.new
      @public_paths << Pathname(application.public_path) if application.respond_to?(:public_path)

      spokes.each do |spoke|
        spoke.services = @services
        @applications << spoke.new

        @public_paths << Pathname(spoke.public_path) if spoke.respond_to?(:public_path)
      end

      @public_paths << Pathname("public")
    end

    def call(env)
      request = Request.new(self, env)
      response = Response.new(request)

      if file = find_public_file(request.path_info[1..-1])
        response.stream_file(file)
        return response.to_a
      end

      application, handler = nil<commit_msg>Fixes to work with composed_services branch.<commit_after>module Wheels
  class Cascade

    def initialize(environment, services, application, *spokes)
      unless services.is_a?(Wheels::Container)
        raise ArgumentError.new("Wheels::Cascade#initialize[services] must be a Wheels::Container")
      end

      @services = services
      @applications = []
      @public_paths = []

      @applications << application.new(services, environment)
      @public_paths << Pathname(application.public_path) if application.respond_to?(:public_path)

      spokes.each do |spoke|
        @applications << spoke.new(services, environment)

        @public_paths << Pathname(spoke.public_path) if spoke.respond_to?(:public_path)
      end

      @public_paths << Pathname("public")
    end

    def call(env)
      request = Request.new(self, env)
      response = Response.new(request)

      if file = find_public_file(request.path_info[1..-1])
        response.stream_file(file)
        return response.to_a
      end

      application, handler = nil
{'fraction_non_alphanumeric': 0.10503175378602833, 'fraction_numerical': 0.0019540791402051783, 'mean_word_length': 3.0796812749003983, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5409653', 'n_tokens_mistral': 597, 'n_tokens_neox': 583, 'n_words': 123}