Class: Plumbo::Configuration
- Inherits:
-
Object
- Object
- Plumbo::Configuration
- Defined in:
- lib/plumbo/configuration.rb
Overview
Runtime configuration for the panel. Defaults are dev-only and safe; override in an initializer via Plumbo.configure { |c| … }.
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Whether the panel is injected.
-
#include_stimulus ⇒ Object
Whether to list Stimulus controllers found via data-controller attributes in the rendered HTML.
-
#javascript_root ⇒ Object
Source directory Stimulus controllers are mapped into.
-
#max_files ⇒ Object
Hard cap on the number of files listed (guards against runaway pages).
-
#path_prefix ⇒ Object
Prefix added to each listed path.
-
#root ⇒ Object
Project root, used to (a) filter render events down to app files and (b) make listed paths relative.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 31 32 33 34 |
# File 'lib/plumbo/configuration.rb', line 27 def initialize @enabled = rails_development? @max_files = 500 @path_prefix = "@" @include_stimulus = true @javascript_root = "app/javascript" @root = nil end |
Instance Attribute Details
#enabled ⇒ Object
Whether the panel is injected. Defaults to true only in Rails development.
8 9 10 |
# File 'lib/plumbo/configuration.rb', line 8 def enabled @enabled end |
#include_stimulus ⇒ Object
Whether to list Stimulus controllers found via data-controller attributes in the rendered HTML. Defaults to true.
19 20 21 |
# File 'lib/plumbo/configuration.rb', line 19 def include_stimulus @include_stimulus end |
#javascript_root ⇒ Object
Source directory Stimulus controllers are mapped into. Combined with the “controllers/” subdirectory and the Stimulus identifier to form the path.
23 24 25 |
# File 'lib/plumbo/configuration.rb', line 23 def javascript_root @javascript_root end |
#max_files ⇒ Object
Hard cap on the number of files listed (guards against runaway pages).
11 12 13 |
# File 'lib/plumbo/configuration.rb', line 11 def max_files @max_files end |
#path_prefix ⇒ Object
Prefix added to each listed path. “@” makes the list paste-ready as file mentions for an AI assistant; set to “” for bare paths.
15 16 17 |
# File 'lib/plumbo/configuration.rb', line 15 def path_prefix @path_prefix end |
#root ⇒ Object
Project root, used to (a) filter render events down to app files and (b) make listed paths relative. Defaults to Rails.root, then the cwd.
38 39 40 |
# File 'lib/plumbo/configuration.rb', line 38 def root @root ||= rails_root || Dir.pwd end |