Module: RailsOnboarding::Configuration::Templates

Included in:
RailsOnboarding::Configuration
Defined in:
lib/rails_onboarding/configuration/templates.rb

Overview

Pre-built onboarding step templates for common app types.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#onboarding_templatesObject

Returns the value of attribute onboarding_templates.



5
6
7
# File 'lib/rails_onboarding/configuration/templates.rb', line 5

def onboarding_templates
  @onboarding_templates
end

Instance Method Details

#apply_template(template_key) ⇒ Boolean

Apply a template to the current configuration

Parameters:

  • template_key (Symbol, String)

    The template key to apply

Returns:

  • (Boolean)

    True if template was applied successfully



19
20
21
22
23
24
25
# File 'lib/rails_onboarding/configuration/templates.rb', line 19

def apply_template(template_key)
  template = onboarding_templates[template_key.to_sym]
  return false unless template

  @steps = template[:steps]
  true
end

#template(template_key) ⇒ Hash?

Get an onboarding template by key

Parameters:

  • template_key (Symbol, String)

    The template key

Returns:

  • (Hash, nil)

    The template configuration or nil



11
12
13
# File 'lib/rails_onboarding/configuration/templates.rb', line 11

def template(template_key)
  onboarding_templates[template_key.to_sym]
end