onboardable 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1aeeceb88e43c0cefe319f2fa5e301618b0d4b3a57d34edc507298e752cd52ec
4
- data.tar.gz: d29c89bf6488afe8d46f8f948bdc892b40172953ccf8bb3f5cf1d8191b7ad48a
3
+ metadata.gz: ef1662a800c2b2c562af504026f4a84bd7a93c895236784e20e53659d7fdcaa3
4
+ data.tar.gz: 90df600da2944d056ca6d64891a311e4507f1227c2827b44485735451ccc329d
5
5
  SHA512:
6
- metadata.gz: 053a72f2dab37f639b258e74f4f984d688af673dd43c3771b583f7ba46da4e3f9c28d64fb4972642669d266711b1b811c662e16718f2d32929a8b4612dc605bb
7
- data.tar.gz: abd9ce8f2775ade5edd1a3b2450f0c873a7e9a5156135c43ed4a80bd5a46a156d94a44dac14b0ade16d32f220b4e14511a15a19ca36af8d71d90425fb4c59179
6
+ metadata.gz: 32e156cde48492f62a29a41b1c382c1be86bd5922b47ddcd32a5ca606127204002f8805da9c1adc087ea005c90a26a20de9081939617d9f623f9b5075fecd113
7
+ data.tar.gz: 3f8a70a79552741d71c0de140204220e66d70b5a43e5e7ce3c54c15b06900e55e15f5c840812c3463f3c10909bb693788e0aeaeb8039617a026b2fe2cef2bcc0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ - Added `onboarding` class method to define the onboarding steps.
6
+ - Added [documentation link](https://rubydoc.info/gems/onboardable) to gemspec.
7
+
5
8
  ## [1.1.0] - 2024-05-21
6
9
 
7
10
  - Introduced `step_from` method for adding steps from external sources.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- onboardable (1.1.0)
4
+ onboardable (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -41,27 +41,20 @@ project as per the installation guide provided earlier.
41
41
  include Onboardable
42
42
 
43
43
  has_onboarding do
44
- # Welcome step with a greeting message.
44
+ # Use the `step` method to steps with a name and optional data
45
45
  step 'welcome', message: 'Welcome to your new account!'
46
-
47
- # Account setup step for credentials.
48
46
  step 'account_setup', task: 'Create credentials'
47
+ step 'confirmation'
49
48
 
50
- # Profile completion step to add photo and bio.
51
- step 'profile_completion', task: 'Add a photo and bio'
52
-
53
- # Confirmation step to verify details before completion.
54
- step 'confirmation', prompt: 'Confirm your details'
55
-
56
- # Use `step_from` to add steps from external sources for reusability.
49
+ # Use the `step_from` method to define steps from external providers
57
50
  step_from ExternalStepProvider
58
51
  end
59
52
  end
60
53
 
61
54
  # External class for providing a reusable onboarding step
62
55
  class ExternalStepProvider
63
- # Define a method to return an onboarding step
64
- def self.to_onboardable_step
56
+ # Define class method to return an onboarding step
57
+ def self.to_onboarding_step
65
58
  Onboardable::Step.new('external_step', info: 'This is an external step.')
66
59
  end
67
60
  end
@@ -40,7 +40,7 @@ module Onboardable
40
40
 
41
41
  # Constructs a new List object from the steps added to the builder.
42
42
  #
43
- # @param current_step_name [String] The name of the step to mark as current in the built list.
43
+ # @param current_step_name [String, nil] The name of the step to mark as current in the built list. Can be nil.
44
44
  # @return [Base] A new List object initialized with the steps and the specified current step.
45
45
  # @raise [EmptyStepsError] if no steps have been added to the builder.
46
46
  def build!(current_step_name)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onboardable
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
data/lib/onboardable.rb CHANGED
@@ -12,7 +12,8 @@ require_relative 'onboardable/version'
12
12
  module Onboardable
13
13
  # Initializes the Onboardable module when included in a class, extending it with class and instance methods.
14
14
  #
15
- # @param klass [Class] the class including the Onboardable module
15
+ # @param klass [Module] the class including the Onboardable module
16
+ # @return [untyped]
16
17
  def self.included(klass)
17
18
  klass.extend ClassMethods
18
19
  klass.include InstanceMethods
@@ -30,20 +31,29 @@ module Onboardable
30
31
  # Configures onboarding steps via a ListBuilder with a provided block.
31
32
  #
32
33
  # @yield [List::Builder] executes block in the context of List::Builder
34
+ # @return [Step] the current step in the building process
33
35
  def list_builder=(&block)
34
36
  list_builder.instance_eval(&block)
35
37
  end
36
38
  alias has_onboarding list_builder=
39
+
40
+ # Builds the onboarding list and optionally sets the current step.
41
+ #
42
+ # @param current_step_name [String, nil] the name of the current step, if specified
43
+ # @return [List::Base] the List built from the class's ListBuilder
44
+ def onboarding(current_step_name = nil)
45
+ list_builder.build!(current_step_name)
46
+ end
37
47
  end
38
48
 
39
49
  # Instance methods for onboarding navigation, added to classes including Onboardable.
40
50
  module InstanceMethods
41
- # Builds a List from the ListBuilder at the class level, optionally specifying the current step.
51
+ # Builds the onboarding list and optionally sets the current step.
42
52
  #
43
53
  # @param current_step_name [String, nil] the name of the current step, if specified
44
54
  # @return [List::Base] the List built from the class's ListBuilder
45
55
  def onboarding(current_step_name = nil)
46
- self.class.list_builder.build!(current_step_name)
56
+ self.class.onboarding(current_step_name)
47
57
  end
48
58
  end
49
59
  end
data/sig/onboardable.rbs CHANGED
@@ -7,9 +7,11 @@ module Onboardable
7
7
 
8
8
  def list_builder=: () { () -> List::Builder } -> Step
9
9
  alias has_onboarding list_builder=
10
+
11
+ def onboarding: (String?) -> List::Base
10
12
  end
11
13
 
12
14
  module InstanceMethods
13
- def onboarding: (String?) -> List
15
+ def onboarding: (String?) -> List::Base
14
16
  end
15
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onboardable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Skrynnyk
@@ -164,7 +164,7 @@ metadata:
164
164
  homepage_uri: https://github.com/dmrAnderson/onboardable
165
165
  changelog_uri: https://github.com/dmrAnderson/onboardable/blob/main/CHANGELOG.md
166
166
  bug_tracker_uri: https://github.com/dmrAnderson/onboardable/issues
167
- documentation_uri: https://github.com/dmrAnderson/onboardable/blob/main/README.md
167
+ documentation_uri: https://rubydoc.info/gems/onboardable
168
168
  rubygems_mfa_required: 'true'
169
169
  post_install_message:
170
170
  rdoc_options: []