Class: RailsOnboarding::Configuration
- Inherits:
-
Object
- Object
- RailsOnboarding::Configuration
- Includes:
- AbTesting, Analytics, Integrations, Milestones, Personalization, ProgressiveDisclosure, RateLimiting, Steps, Templates, Tooltips
- Defined in:
- lib/rails_onboarding/configuration.rb,
lib/rails_onboarding/configuration/steps.rb,
lib/rails_onboarding/configuration/tooltips.rb,
lib/rails_onboarding/configuration/analytics.rb,
lib/rails_onboarding/configuration/templates.rb,
lib/rails_onboarding/configuration/ab_testing.rb,
lib/rails_onboarding/configuration/milestones.rb,
lib/rails_onboarding/configuration/integrations.rb,
lib/rails_onboarding/configuration/rate_limiting.rb,
lib/rails_onboarding/configuration/personalization.rb,
lib/rails_onboarding/configuration/progressive_disclosure.rb
Overview
Every reader/writer here is part of this gem's public configuration DSL (host apps set these in a RailsOnboarding.configure block), so none of them can change shape without breaking every existing installation. The ~40 settings are grouped by feature into the modules under configuration/ - each one owns its own defaults and any logic specific to it, so a change to (say) A/B testing only touches configuration/ab_testing.rb instead of this whole file. What's left here is identity/branding settings with no logic of their own, plus the infrastructure the feature modules share (tenant overrides, the derived- lookup cache, and the validator).
Defined Under Namespace
Modules: AbTesting, Analytics, Integrations, Milestones, Personalization, ProgressiveDisclosure, RateLimiting, Steps, Templates, Tooltips
Instance Attribute Summary collapse
-
#admin_user_search ⇒ Object
Returns the value of attribute admin_user_search.
-
#custom_css_path ⇒ Object
Returns the value of attribute custom_css_path.
-
#custom_js_path ⇒ Object
Returns the value of attribute custom_js_path.
-
#include_host_styles ⇒ Object
Returns the value of attribute include_host_styles.
-
#redirect_after_completion ⇒ Object
Returns the value of attribute redirect_after_completion.
-
#redirect_after_skip ⇒ Object
Returns the value of attribute redirect_after_skip.
-
#user_class_name ⇒ Object
Returns the value of attribute user_class_name.
-
#welcome_features ⇒ Object
Returns the value of attribute welcome_features.
-
#welcome_heading ⇒ Object
Returns the value of attribute welcome_heading.
-
#welcome_subheading ⇒ Object
Returns the value of attribute welcome_subheading.
Attributes included from Templates
Attributes included from RateLimiting
#rate_limit_per_period, #rate_limit_period, #rate_limiting_enabled
Attributes included from Integrations
#api_authentication_method, #api_mode_enabled, #background_jobs_enabled, #background_jobs_queue, #devise_integration_enabled, #mailer_from, #redirect_unconfirmed_to_onboarding, #turbo_morphing_enabled, #turbo_streams_enabled
Attributes included from ProgressiveDisclosure
#progressive_disclosure_enabled, #progressive_features
Attributes included from Personalization
#personalization_enabled, #personalized_flows, #user_type_method
Attributes included from AbTesting
Attributes included from Analytics
#analytics_data_retention_days, #analytics_retention_days, #analytics_session_timeout_minutes, #enable_analytics
Attributes included from Tooltips
#enable_tooltips, #feature_tooltips
Attributes included from Milestones
Attributes included from Steps
Instance Method Summary collapse
-
#clear_cache! ⇒ Object
Clear all cached lookups - call this when configuration changes.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #user_class ⇒ Object
-
#valid? ⇒ Boolean
Check if the configuration is valid without raising.
-
#validate! ⇒ Object
Validate the current configuration.
-
#validation_errors ⇒ Array<StandardError>
Get validation errors without raising.
-
#validator ⇒ ConfigurationValidator
Get the validator instance for this configuration.
Methods included from Templates
Methods included from ProgressiveDisclosure
Methods included from Personalization
Methods included from AbTesting
Methods included from Milestones
#milestone_by_key, #milestones, #milestones=, #milestones_for_trigger
Methods included from Steps
#step_by_name, #step_index, #steps, #steps=, #total_steps
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/rails_onboarding/configuration.rb', line 47 def initialize @user_class_name = "User" @include_host_styles = true # Default to including host app css # Asset name of a host stylesheet to load after everything else on # onboarding pages, for retheming the flow. The install generator writes # app/assets/stylesheets/rails_onboarding_custom.css; set this to # "rails_onboarding_custom" to actually load it. nil = load nothing. @custom_css_path = nil @redirect_after_completion = :root_path @redirect_after_skip = :root_path @welcome_heading = "We're excited to have you here!" @welcome_subheading = "Now, let's take a few moments to get you set up and familiar with a few things you need to know to get started." @welcome_features = [ { icon: "👤", text: "Set up your profile" }, { icon: "📝", text: "Create your first item" }, { icon: "🔍", text: "Explore key features" } ] # Optional override for the admin User Management search box. The # built-in search is plain SQL, which can't see through an encrypted # email column - a host app that encrypts email and still wants partial # matching has to supply the strategy itself. Receives the already # status/step-filtered scope and the raw term, and must return a # relation (not an array) so sorting and pagination still apply. @admin_user_search = nil initialize_steps initialize_milestones initialize_tooltips initialize_analytics initialize_ab_testing initialize_personalization initialize_progressive_disclosure initialize_integrations initialize_rate_limiting initialize_templates end |
Instance Attribute Details
#admin_user_search ⇒ Object
Returns the value of attribute admin_user_search.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def admin_user_search @admin_user_search end |
#custom_css_path ⇒ Object
Returns the value of attribute custom_css_path.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def custom_css_path @custom_css_path end |
#custom_js_path ⇒ Object
Returns the value of attribute custom_js_path.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def custom_js_path @custom_js_path end |
#include_host_styles ⇒ Object
Returns the value of attribute include_host_styles.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def include_host_styles @include_host_styles end |
#redirect_after_completion ⇒ Object
Returns the value of attribute redirect_after_completion.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def redirect_after_completion @redirect_after_completion end |
#redirect_after_skip ⇒ Object
Returns the value of attribute redirect_after_skip.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def redirect_after_skip @redirect_after_skip end |
#user_class_name ⇒ Object
Returns the value of attribute user_class_name.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def user_class_name @user_class_name end |
#welcome_features ⇒ Object
Returns the value of attribute welcome_features.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def welcome_features @welcome_features end |
#welcome_heading ⇒ Object
Returns the value of attribute welcome_heading.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def welcome_heading @welcome_heading end |
#welcome_subheading ⇒ Object
Returns the value of attribute welcome_subheading.
36 37 38 |
# File 'lib/rails_onboarding/configuration.rb', line 36 def welcome_subheading @welcome_subheading end |
Instance Method Details
#clear_cache! ⇒ Object
Clear all cached lookups - call this when configuration changes
115 116 117 118 119 120 121 122 123 |
# File 'lib/rails_onboarding/configuration.rb', line 115 def clear_cache! @user_class = nil @total_steps = nil @step_by_name_cache = nil @step_index_cache = nil @milestone_by_key_cache = nil @milestones_for_trigger_cache = nil @validator = nil end |
#user_class ⇒ Object
110 111 112 |
# File 'lib/rails_onboarding/configuration.rb', line 110 def user_class @user_class ||= @user_class_name.constantize end |
#valid? ⇒ Boolean
Check if the configuration is valid without raising
94 95 96 |
# File 'lib/rails_onboarding/configuration.rb', line 94 def valid? validator.valid? end |
#validate! ⇒ Object
Validate the current configuration
88 89 90 |
# File 'lib/rails_onboarding/configuration.rb', line 88 def validate! validator.validate! end |
#validation_errors ⇒ Array<StandardError>
Get validation errors without raising
106 107 108 |
# File 'lib/rails_onboarding/configuration.rb', line 106 def validation_errors validator.errors end |
#validator ⇒ ConfigurationValidator
Get the validator instance for this configuration
100 101 102 |
# File 'lib/rails_onboarding/configuration.rb', line 100 def validator @validator ||= ConfigurationValidator.new(self) end |