Class: Plutonium::Wizard::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/plutonium/wizard/configuration.rb

Overview

Configuration for the Plutonium wizard subsystem.

Exposed via Configuration#wizards.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Initialize a new wizard Configuration instance with default values.



44
45
46
47
48
49
50
51
# File 'lib/plutonium/wizard/configuration.rb', line 44

def initialize
  @width = :md
  @enabled = false
  @cleanup_after = 14.days
  @database = :primary
  @encrypt_data = false
  @attachment_backend = nil
end

Instance Attribute Details

#attachment_backendSymbol?

Returns the storage backend used to SERVER-SIDE-stage a plain (non-direct-upload) wizard attachment field — :active_storage or :shrine. nil auto-detects (active_shrine loaded → :shrine, else :active_storage). A field may override with input …, backend:. Only relevant when a file rides the step POST; direct-upload fields already arrive as a token and ignore this.

Returns:

  • (Symbol, nil)

    the storage backend used to SERVER-SIDE-stage a plain (non-direct-upload) wizard attachment field — :active_storage or :shrine. nil auto-detects (active_shrine loaded → :shrine, else :active_storage). A field may override with input …, backend:. Only relevant when a file rides the step POST; direct-upload fields already arrive as a token and ignore this.



30
31
32
# File 'lib/plutonium/wizard/configuration.rb', line 30

def attachment_backend
  @attachment_backend
end

#cleanup_afterActiveSupport::Duration

Returns how long completed/abandoned sessions are kept.

Returns:

  • (ActiveSupport::Duration)

    how long completed/abandoned sessions are kept



13
14
15
# File 'lib/plutonium/wizard/configuration.rb', line 13

def cleanup_after
  @cleanup_after
end

#databaseSymbol

Returns which database wizard tables live in.

Returns:

  • (Symbol)

    which database wizard tables live in



16
17
18
# File 'lib/plutonium/wizard/configuration.rb', line 16

def database
  @database
end

#enabledBoolean

Returns whether the wizard subsystem (and its migrations) is enabled.

Returns:

  • (Boolean)

    whether the wizard subsystem (and its migrations) is enabled



10
11
12
# File 'lib/plutonium/wizard/configuration.rb', line 10

def enabled
  @enabled
end

#encrypt_dataBoolean

Returns encrypt every wizard's staged data at rest by default. Off by default because it needs ActiveRecord encryption keys configured; a wizard may still opt in (encrypt_data) or out (encrypt_data false) individually regardless of this default.

Returns:

  • (Boolean)

    encrypt every wizard's staged data at rest by default. Off by default because it needs ActiveRecord encryption keys configured; a wizard may still opt in (encrypt_data) or out (encrypt_data false) individually regardless of this default.



22
23
24
# File 'lib/plutonium/wizard/configuration.rb', line 22

def encrypt_data
  @encrypt_data
end

#widthSymbol

Returns width for wizard step pages, one of UI::PageWidth::VALID_SIZES.

Deliberately INDEPENDENT of config.default_page_width. A wizard is its own kind of page — a focused, self-contained flow, not a resource detail page — so an app that widens (or unconstrains) its resource pages should not silently drag its wizards along. The default here happens to match the resource default, but nothing ties them: change one and the other stays put.

Returns:

  • (Symbol)

    width for wizard step pages, one of UI::PageWidth::VALID_SIZES.

    Deliberately INDEPENDENT of config.default_page_width. A wizard is its own kind of page — a focused, self-contained flow, not a resource detail page — so an app that widens (or unconstrains) its resource pages should not silently drag its wizards along. The default here happens to match the resource default, but nothing ties them: change one and the other stays put.



41
42
43
# File 'lib/plutonium/wizard/configuration.rb', line 41

def width
  @width
end