Class: RailsAiBridge::StaticApp
- Inherits:
-
Object
- Object
- RailsAiBridge::StaticApp
- Defined in:
- lib/rails_ai_bridge/static_app.rb
Overview
A minimal app-like object for static mode (no Rails boot).
Exposes only root, paths, config, and eager_load! so that
static-capable introspectors (schema, gems, tests, migrations) can
operate without a booted Rails application. Boot-required introspectors
(models, routes, controllers, etc.) are identified via the capability
map and report "not available without boot" when invoked in static mode.
Constant Summary collapse
- STATIC_CAPABLE =
Introspectors that work with only file system access (no Rails boot).
%i[schema gems tests migrations conventions].freeze
- BOOT_REQUIRED =
Introspectors that require a fully booted Rails application.
%i[ models non_ar_models routes jobs controllers views stimulus i18n config active_storage action_text auth api rake_tasks assets devops action_mailbox seeds middleware engines multi_database semantic database_stats ].freeze
- CONVENTIONAL_PATHS =
Conventional Rails path mappings used when app.paths is unavailable.
{ 'app/models' => 'app/models', 'app/controllers' => 'app/controllers', 'app/views' => 'app/views', 'app/jobs' => 'app/jobs', 'app/mailers' => 'app/mailers', 'app/helpers' => 'app/helpers', 'app/assets' => 'app/assets', 'config' => 'config', 'db' => 'db', 'lib' => 'lib', 'test' => 'test', 'spec' => 'spec' }.freeze
Instance Attribute Summary collapse
-
#config ⇒ StaticConfig
readonly
A minimal config stub.
-
#root ⇒ Pathname
readonly
The application root.
Class Method Summary collapse
-
.static_available?(section) ⇒ Boolean
Checks whether a given introspector section is available in static mode.
Instance Method Summary collapse
-
#eager_load ⇒ nil
Non-bang counterpart for #eager_load!.
-
#eager_load! ⇒ nil
No-op — static mode does not eager load anything.
-
#initialize(root) ⇒ StaticApp
constructor
A new instance of StaticApp.
-
#paths ⇒ Hash{String => Array<String>}
Returns conventional Rails paths rooted at the static app root.
Constructor Details
Instance Attribute Details
#config ⇒ StaticConfig (readonly)
Returns a minimal config stub.
60 61 62 |
# File 'lib/rails_ai_bridge/static_app.rb', line 60 def config @config end |
#root ⇒ Pathname (readonly)
Returns the application root.
57 58 59 |
# File 'lib/rails_ai_bridge/static_app.rb', line 57 def root @root end |
Class Method Details
.static_available?(section) ⇒ Boolean
Checks whether a given introspector section is available in static mode.
94 95 96 |
# File 'lib/rails_ai_bridge/static_app.rb', line 94 def static_available?(section) STATIC_CAPABLE.include?(section) end |
Instance Method Details
#eager_load ⇒ nil
Non-bang counterpart for #eager_load!. Also a no-op in static mode.
78 79 80 |
# File 'lib/rails_ai_bridge/static_app.rb', line 78 def eager_load nil end |
#eager_load! ⇒ nil
No-op — static mode does not eager load anything.
71 72 73 |
# File 'lib/rails_ai_bridge/static_app.rb', line 71 def eager_load! nil end |
#paths ⇒ Hash{String => Array<String>}
Returns conventional Rails paths rooted at the static app root.
85 86 87 |
# File 'lib/rails_ai_bridge/static_app.rb', line 85 def paths @paths ||= CONVENTIONAL_PATHS.transform_values { |rel| [root.join(rel).to_s] } end |