Module: Rage
- Defined in:
- lib/rage-rb.rb,
lib/rage/version.rb
Defined Under Namespace
Modules: CLI, Cable, Deferred, Errors, Events, Ext, OpenAPI, PubSub, Router, SSE, Telemetry Classes: Application, BodyFinalizer, CodeLoader, Configuration, Cookies, Cors, Daemon, Env, FiberScheduler, FiberWrapper, JSONFormatter, LogProcessor, Logger, OriginValidator, ParamsParser, Reloader, Request, RequestId, Response, Session, Tasks, TextFormatter, UploadedFile
Constant Summary collapse
- VERSION =
"1.29.0"
Class Method Summary collapse
-
.application ⇒ Object
Builds the Rage application with the configured middlewares.
-
.cable ⇒ Rage::Cable
Shorthand to access Rage::Cable.
-
.config ⇒ Rage::Configuration
(also: configuration)
Access the Rage configuration.
-
.configure ⇒ Object
Configure Rage using a block.
-
.deferred ⇒ Rage::Deferred
Shorthand to access Rage::Deferred.
-
.env ⇒ Rage::Env
Access the current Rage environment.
-
.errors ⇒ Rage::Errors
Shorthand to access Rage::Errors.
-
.events ⇒ Rage::Events
Shorthand to access Rage::Events.
-
.groups ⇒ Object
Access the current Gem groups based on the Rage environment.
-
.load_middlewares(_) ⇒ Object
deprecated
Deprecated.
This method is deprecated and has been merged into
Rage.application. -
.load_tasks ⇒ Object
Load Rake tasks for the Rage application.
-
.logger ⇒ Rage::Logger
Access the Rage logger.
-
.multi_application ⇒ Object
Builds the Rage application which delegates Rails requests to
Rails.application. -
.openapi ⇒ Rage::OpenAPI
Shorthand to access Rage::OpenAPI.
-
.root ⇒ Pathname
Access the root path of the Rage application.
-
.routes ⇒ Rage::Router::DSL::Handler
Configure routes for the Rage application.
-
.sse ⇒ Rage::SSE
Shorthand to access Rage::SSE.
Class Method Details
.application ⇒ Object
Builds the Rage application with the configured middlewares.
10 11 12 13 14 15 16 17 |
# File 'lib/rage-rb.rb', line 10 def self.application middleware = config.middleware.middlewares if Fiber.scheduler && Fiber.current != Fiber.scheduler.root_fiber middleware = middleware.reject { |m, _, _| m == Rage::FiberWrapper } end with_middlewares(Application.new(__router), middleware) end |
.cable ⇒ Rage::Cable
Shorthand to access Rage::Cable.
26 27 28 |
# File 'lib/rage-rb.rb', line 26 def self.cable Rage::Cable end |
.config ⇒ Rage::Configuration Also known as: configuration
Access the Rage configuration.
82 83 84 |
# File 'lib/rage-rb.rb', line 82 def self.config @config ||= Rage::Configuration.new end |
.configure ⇒ Object
Configure Rage using a block.
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/rage-rb.rb', line 91 def self.configure(&) if Rage::Extension.subclasses.any? && !@__extension_config_applied Rage::Extension.__configurations.each { |block| config.instance_eval(&block) } config.__finalize @__extension_config_applied = true end config.instance_eval(&) config.__finalize end |
.deferred ⇒ Rage::Deferred
Shorthand to access Rage::Deferred.
38 39 40 |
# File 'lib/rage-rb.rb', line 38 def self.deferred Rage::Deferred end |
.env ⇒ Rage::Env
Access the current Rage environment.
108 109 110 |
# File 'lib/rage-rb.rb', line 108 def self.env @__env ||= Rage::Env.new(ENV["RAGE_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development") end |
.errors ⇒ Rage::Errors
Shorthand to access Rage::Errors.
50 51 52 |
# File 'lib/rage-rb.rb', line 50 def self.errors Rage::Errors end |
.events ⇒ Rage::Events
Shorthand to access Rage::Events.
44 45 46 |
# File 'lib/rage-rb.rb', line 44 def self.events Rage::Events end |
.groups ⇒ Object
Access the current Gem groups based on the Rage environment.
113 114 115 |
# File 'lib/rage-rb.rb', line 113 def self.groups [:default, Rage.env.to_sym] end |
.load_middlewares(_) ⇒ Object
This method is deprecated and has been merged into Rage.application.
Load middlewares into the Rage application.
131 132 133 |
# File 'lib/rage-rb.rb', line 131 def self.load_middlewares(_) puts "`Rage.load_middlewares` is deprecated and has been merged into `Rage.application`. Please remove this call." end |
.load_tasks ⇒ Object
Load Rake tasks for the Rage application.
165 166 167 |
# File 'lib/rage-rb.rb', line 165 def self.load_tasks Rage::Tasks.init end |
.logger ⇒ Rage::Logger
Access the Rage logger.
125 126 127 |
# File 'lib/rage-rb.rb', line 125 def self.logger @logger ||= config.logger end |
.multi_application ⇒ Object
Builds the Rage application which delegates Rails requests to Rails.application.
20 21 22 |
# File 'lib/rage-rb.rb', line 20 def self.multi_application Rage::Router::Util::Cascade.new(application, Rails.application) end |
.openapi ⇒ Rage::OpenAPI
Shorthand to access Rage::OpenAPI.
32 33 34 |
# File 'lib/rage-rb.rb', line 32 def self.openapi Rage::OpenAPI end |
.root ⇒ Pathname
Access the root path of the Rage application.
119 120 121 |
# File 'lib/rage-rb.rb', line 119 def self.root @root ||= Pathname.new("."). end |
.routes ⇒ Rage::Router::DSL::Handler
Configure routes for the Rage application.
66 67 68 |
# File 'lib/rage-rb.rb', line 66 def self.routes Rage::Router::DSL.new(__router) end |