Class: Plumbo::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#enabledObject

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_stimulusObject

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_rootObject

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_filesObject

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_prefixObject

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

#rootObject

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