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.
-
#highlight ⇒ Object
Whether hovering a view/partial/layout row highlights its rendered region on the page.
-
#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.
34 35 36 37 38 39 40 41 42 |
# File 'lib/plumbo/configuration.rb', line 34 def initialize @enabled = rails_development? @max_files = 500 @path_prefix = "@" @include_stimulus = true @highlight = 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 |
#highlight ⇒ Object
Whether hovering a view/partial/layout row highlights its rendered region on the page. Defaults to true. When on, Plumbo enables Rails' built-in annotate_rendered_view_with_filenames so the rendered HTML carries the BEGIN/END comment markers the highlight reads. Turn off to leave the host app's HTML untouched (highlighting then does nothing).
26 27 28 |
# File 'lib/plumbo/configuration.rb', line 26 def highlight @highlight 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.
30 31 32 |
# File 'lib/plumbo/configuration.rb', line 30 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.
46 47 48 |
# File 'lib/plumbo/configuration.rb', line 46 def root @root ||= rails_root || Dir.pwd end |