Module: Onboardable::ClassMethods

Defined in:
lib/onboardable.rb

Overview

Class methods for managing the onboarding process, added to the class that includes the Onboardable module.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#list_builderList::Builder

Returns The ListBuilder for configuring onboarding steps.

Returns:

  • (List::Builder)

    The ListBuilder for configuring onboarding steps.



25
26
27
# File 'lib/onboardable.rb', line 25

def list_builder
  @list_builder
end

Instance Method Details

#onboarding(current_step_name = nil) ⇒ List::Base

Builds the onboarding list and optionally sets the current step.

Parameters:

  • current_step_name (String, nil) (defaults to: nil)

    The name of the current step, if specified.

Returns:

  • (List::Base)

    The List built from the class’s ListBuilder.



42
43
44
# File 'lib/onboardable.rb', line 42

def onboarding(current_step_name = nil)
  list_builder.build(current_step_name)
end

#onboarding=(options = {}) {|List::Builder| ... } ⇒ Step Also known as: has_onboarding

Configures onboarding steps via a ListBuilder with a provided block.

Parameters:

  • options (Hash) (defaults to: {})

    Optional configuration options for the ListBuilder.

Yields:

  • (List::Builder)

    Executes block in the context of List::Builder.

Returns:

  • (Step)

    The current step in the building process.



32
33
34
35
# File 'lib/onboardable.rb', line 32

def onboarding=(options = {}, &block)
  self.list_builder = List::Builder.new(options)
  list_builder.instance_eval(&block)
end