<commit_before>require_relative 'router'
require_relative 'request'
require_relative 'dispatcher'

module Flame
	## Core class, like Framework::Application
	class Application
		class << self
			attr_accessor :config
		end

		## Framework configuration
		def config
			self.class.config
		end

		def self.inherited(app)
			app.config = Config.new(
				app,
				default_config_dirs(
					root_dir: File.dirname(caller[0].split(':')[0])
				).merge(
					environment: ENV['RACK_ENV'] || 'development'
				)
			)
		end

		## Init function
		def call(env)
			Flame::Dispatcher.new(self, env).run!
		end

		def self.mount(ctrl, path = nil, &block)
			router.add_controller(ctrl, path, block)
		end

		def self.helpers(*modules)
			modules.empty? ? (@helpers ||= []) : @helpers = modules<commit_msg>Allow run application from rackup by class<commit_after>require_relative 'router'
require_relative 'request'
require_relative 'dispatcher'

module Flame
	## Core class, like Framework::Application
	class Application
		class << self
			attr_accessor :config
		end

		## Framework configuration
		def config
			self.class.config
		end

		def self.inherited(app)
			app.config = Config.new(
				app,
				default_config_dirs(
					root_dir: File.dirname(caller[0].split(':')[0])
				).merge(
					environment: ENV['RACK_ENV'] || 'development'
				)
			)
		end

		def self.call(env)
			@app ||= new
			@app.call env
		end

		## Init function
		def call(env)
			Flame::Dispatcher.new(self, env).run!
		end

		def self.mount(ctrl, path = nil, &block)
			router.add_controller(ctrl, path, block)
		end

		def self.helpers(*modules)
			modules.empty? ? (@helpers ||= []) : @helpers = modules
{'fraction_non_alphanumeric': 0.12485065710872162, 'fraction_numerical': 0.0023894862604540022, 'mean_word_length': 3.6016483516483517, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6403938', 'n_tokens_mistral': 669, 'n_tokens_neox': 555, 'n_words': 132}