onboardable 1.4.0 → 1.5.0
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +18 -18
- data/README.md +35 -35
- data/lib/onboardable/list/base.rb +4 -4
- data/lib/onboardable/list/builder.rb +3 -3
- data/lib/onboardable/step.rb +19 -19
- data/lib/onboardable/version.rb +1 -1
- data/onboardable.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9f0c447b6d3593da8e840bc4964a61fb7078df687a13e0d87bf846d51c17838
|
4
|
+
data.tar.gz: 5b0861f3ff6b98ed383d2497e4bca47bee0893ab98124e3bfd680c3b1e119dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15c8e34a8d136da36ec0a8d968f6140123c5d05cece765e60ed1f95267416bf10373e4ea79159b84095e78485a691f3906a4897c15cb4b85ce377e3337c87b51
|
7
|
+
data.tar.gz: dfdb3df40595dd49dc2860494bb9da050c8124f8e936f17ddd8c52a00626ac7576270d1cb4f793591f0d79277513079975d370a64c44504f5eda8151ed931944
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,40 +1,40 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
onboardable (1.
|
4
|
+
onboardable (1.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.3)
|
10
|
-
diff-lcs (1.6.
|
10
|
+
diff-lcs (1.6.2)
|
11
11
|
docile (1.4.1)
|
12
|
-
json (2.
|
13
|
-
language_server-protocol (3.17.0.
|
12
|
+
json (2.13.2)
|
13
|
+
language_server-protocol (3.17.0.5)
|
14
14
|
lint_roller (1.1.0)
|
15
|
-
parallel (1.
|
16
|
-
parser (3.3.
|
15
|
+
parallel (1.27.0)
|
16
|
+
parser (3.3.9.0)
|
17
17
|
ast (~> 2.4.1)
|
18
18
|
racc
|
19
19
|
prism (1.4.0)
|
20
20
|
racc (1.8.1)
|
21
21
|
rainbow (3.1.1)
|
22
|
-
rake (13.
|
22
|
+
rake (13.3.0)
|
23
23
|
regexp_parser (2.10.0)
|
24
|
-
rspec (3.13.
|
24
|
+
rspec (3.13.1)
|
25
25
|
rspec-core (~> 3.13.0)
|
26
26
|
rspec-expectations (~> 3.13.0)
|
27
27
|
rspec-mocks (~> 3.13.0)
|
28
|
-
rspec-core (3.13.
|
28
|
+
rspec-core (3.13.4)
|
29
29
|
rspec-support (~> 3.13.0)
|
30
|
-
rspec-expectations (3.13.
|
30
|
+
rspec-expectations (3.13.5)
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
32
|
rspec-support (~> 3.13.0)
|
33
|
-
rspec-mocks (3.13.
|
33
|
+
rspec-mocks (3.13.5)
|
34
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
35
|
rspec-support (~> 3.13.0)
|
36
|
-
rspec-support (3.13.
|
37
|
-
rubocop (1.
|
36
|
+
rspec-support (3.13.4)
|
37
|
+
rubocop (1.79.1)
|
38
38
|
json (~> 2.3)
|
39
39
|
language_server-protocol (~> 3.17.0.2)
|
40
40
|
lint_roller (~> 1.1.0)
|
@@ -42,10 +42,10 @@ GEM
|
|
42
42
|
parser (>= 3.3.0.2)
|
43
43
|
rainbow (>= 2.2.2, < 4.0)
|
44
44
|
regexp_parser (>= 2.9.3, < 3.0)
|
45
|
-
rubocop-ast (>= 1.
|
45
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
46
46
|
ruby-progressbar (~> 1.7)
|
47
47
|
unicode-display_width (>= 2.4.0, < 4.0)
|
48
|
-
rubocop-ast (1.
|
48
|
+
rubocop-ast (1.46.0)
|
49
49
|
parser (>= 3.3.7.2)
|
50
50
|
prism (~> 1.4)
|
51
51
|
rubocop-performance (1.25.0)
|
@@ -55,7 +55,7 @@ GEM
|
|
55
55
|
rubocop-rake (0.7.1)
|
56
56
|
lint_roller (~> 1.1)
|
57
57
|
rubocop (>= 1.72.1)
|
58
|
-
rubocop-rspec (3.
|
58
|
+
rubocop-rspec (3.6.0)
|
59
59
|
lint_roller (~> 1.1)
|
60
60
|
rubocop (~> 1.72, >= 1.72.1)
|
61
61
|
ruby-progressbar (1.13.0)
|
@@ -70,7 +70,7 @@ GEM
|
|
70
70
|
unicode-emoji (4.0.4)
|
71
71
|
|
72
72
|
PLATFORMS
|
73
|
-
x86_64-darwin-
|
73
|
+
x86_64-darwin-24
|
74
74
|
x86_64-linux
|
75
75
|
|
76
76
|
DEPENDENCIES
|
@@ -84,4 +84,4 @@ DEPENDENCIES
|
|
84
84
|
simplecov (~> 0.22.0)
|
85
85
|
|
86
86
|
BUNDLED WITH
|
87
|
-
2.
|
87
|
+
2.7.1
|
data/README.md
CHANGED
@@ -65,7 +65,7 @@ could be included in the documentation. This guide covers initialization,
|
|
65
65
|
navigation, step verification, and completion of the onboarding process.
|
66
66
|
|
67
67
|
After defining and accessing the onboarding steps as described
|
68
|
-
earlier,
|
68
|
+
earlier, manage the onboarding process through various controls
|
69
69
|
that allow step navigation and state verification:
|
70
70
|
|
71
71
|
1. **Initialize Onboarding Process**
|
@@ -91,16 +91,16 @@ that allow step navigation and state verification:
|
|
91
91
|
onboarding = builder.build
|
92
92
|
```
|
93
93
|
|
94
|
-
|
94
|
+
2. **Check the order of steps**
|
95
95
|
|
96
96
|
Determine the order of steps in the onboarding process to ensure
|
97
97
|
that the sequence is correct and that the steps are defined as expected.
|
98
98
|
|
99
99
|
```ruby
|
100
|
-
onboarding.steps
|
100
|
+
onboarding.steps
|
101
101
|
```
|
102
102
|
|
103
|
-
|
103
|
+
3. **Navigating Through Steps**
|
104
104
|
|
105
105
|
Navigate through the onboarding steps using the navigation methods provided.
|
106
106
|
These methods help in moving forward and backward through the onboarding process.
|
@@ -111,8 +111,8 @@ that allow step navigation and state verification:
|
|
111
111
|
what's next or advance to it, updating the current step status.
|
112
112
|
|
113
113
|
```ruby
|
114
|
-
onboarding.next_step
|
115
|
-
onboarding.next_step!
|
114
|
+
onboarding.next_step
|
115
|
+
onboarding.next_step!
|
116
116
|
```
|
117
117
|
|
118
118
|
- **Previous Step**
|
@@ -121,32 +121,32 @@ that allow step navigation and state verification:
|
|
121
121
|
making changes or updates to revert to the previous step.
|
122
122
|
|
123
123
|
```ruby
|
124
|
-
onboarding.prev_step
|
125
|
-
onboarding.prev_step!
|
124
|
+
onboarding.prev_step
|
125
|
+
onboarding.prev_step!
|
126
126
|
```
|
127
127
|
|
128
|
-
|
128
|
+
4. **Check Step Position**
|
129
129
|
|
130
130
|
Determine whether the current step is the first or the last in the sequence
|
131
131
|
to manage UI elements like 'Next' or 'Back' buttons appropriately.
|
132
132
|
|
133
133
|
```ruby
|
134
|
-
step = onboarding.steps.sample
|
134
|
+
step = onboarding.steps.sample
|
135
135
|
|
136
|
-
onboarding.first_step?(step)
|
137
|
-
onboarding.last_step?(step)
|
138
|
-
onboarding.current_step?(step)
|
139
|
-
onboarding.second_step?(step)
|
140
|
-
onboarding.prev_step?(step)
|
136
|
+
onboarding.first_step?(step)
|
137
|
+
onboarding.last_step?(step)
|
138
|
+
onboarding.current_step?(step)
|
139
|
+
onboarding.second_step?(step)
|
140
|
+
onboarding.prev_step?(step)
|
141
141
|
```
|
142
142
|
|
143
|
-
|
143
|
+
5. **Monitor Progress**
|
144
144
|
|
145
145
|
- Calculate the progress or completion percentage of the onboarding process
|
146
146
|
to provide users with an indication of how far they have progressed.
|
147
147
|
|
148
148
|
```ruby
|
149
|
-
onboarding.progress
|
149
|
+
onboarding.progress
|
150
150
|
```
|
151
151
|
|
152
152
|
- To customize the progress calculation formula, define a lambda function
|
@@ -172,20 +172,20 @@ that allow step navigation and state verification:
|
|
172
172
|
end
|
173
173
|
```
|
174
174
|
|
175
|
-
|
175
|
+
6. **Access Current Step Details**
|
176
176
|
|
177
177
|
Retrieve details about the current step, which can include the name,
|
178
178
|
custom data, and status, to display appropriate information or help
|
179
|
-
the user
|
179
|
+
the user understand their current position in the onboarding process.
|
180
180
|
|
181
181
|
```ruby
|
182
|
-
onboarding.current_step
|
183
|
-
onboarding.current_step.name
|
184
|
-
onboarding.current_step.data
|
185
|
-
onboarding.current_step.status
|
182
|
+
onboarding.current_step
|
183
|
+
onboarding.current_step.name
|
184
|
+
onboarding.current_step.data
|
185
|
+
onboarding.current_step.status
|
186
186
|
```
|
187
187
|
|
188
|
-
|
188
|
+
7. **Complete the Onboarding Process**
|
189
189
|
|
190
190
|
Once the user reaches the last step and completes it, finalize the
|
191
191
|
onboarding process, which might involve setting a user attribute to
|
@@ -200,12 +200,12 @@ that allow step navigation and state verification:
|
|
200
200
|
# Exception Handling Approach
|
201
201
|
begin
|
202
202
|
onboarding.next_step!
|
203
|
-
rescue LastStepError
|
203
|
+
rescue Onboardable::LastStepError
|
204
204
|
# Implement finalization processes like updating user attributes
|
205
205
|
end
|
206
206
|
```
|
207
207
|
|
208
|
-
|
208
|
+
8. **Exit the Onboarding Process Early**
|
209
209
|
|
210
210
|
Handle cases where a user decides to discontinue the onboarding
|
211
211
|
by attempting to navigate back from the initial step.
|
@@ -219,7 +219,7 @@ that allow step navigation and state verification:
|
|
219
219
|
# Exception Handling Approach
|
220
220
|
begin
|
221
221
|
onboarding.prev_step!
|
222
|
-
rescue FirstStepError
|
222
|
+
rescue Onboardable::FirstStepError
|
223
223
|
# Implement cleanup or final actions for an orderly exit
|
224
224
|
end
|
225
225
|
```
|
@@ -230,13 +230,13 @@ user-friendly onboarding process using the Onboardable gem.
|
|
230
230
|
## 🛠 Development
|
231
231
|
|
232
232
|
1. After checking out the repo, run `bin/setup` to install dependencies.
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
233
|
+
2. Then, run `rake spec` to run the tests.
|
234
|
+
3. Also run `bin/console` for an interactive prompt that will allow you to experiment.
|
235
|
+
4. To install this gem onto your local machine, run `bundle exec rake install`.
|
236
|
+
5. To release a new version, update the version number in `version.rb`.
|
237
|
+
6. After, run `bundle exec rake release`, which will create a git tag for the version.
|
238
|
+
7. Push git commits and the created tag.
|
239
|
+
8. Then push the `.gem` file to [rubygems.org](https://rubygems.org).
|
240
240
|
|
241
241
|
## 🤝 Contributing
|
242
242
|
|
@@ -250,5 +250,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
250
250
|
|
251
251
|
## 📜 Code of Conduct
|
252
252
|
|
253
|
-
Everyone interacting
|
253
|
+
Everyone interacting with the Onboardable project's codebases, issue trackers,
|
254
254
|
chat rooms and mailing lists are expected to follow the [code of conduct](https://github.com/dmrAnderson/onboardable/blob/main/CODE_OF_CONDUCT.md).
|
@@ -14,11 +14,11 @@ module Onboardable
|
|
14
14
|
# @return [Step] The current step in the list.
|
15
15
|
attr_reader :current_step
|
16
16
|
|
17
|
-
# Initializes a new instance of List with steps and a current step.
|
17
|
+
# Initializes a new instance of the List with steps and a current step.
|
18
18
|
#
|
19
19
|
# @param steps [Array<Step>] An array of steps comprising the onboarding process.
|
20
20
|
# @param current_step [Step] The step currently active in the process.
|
21
|
-
# @param options [Hash]
|
21
|
+
# @param options [Hash] Optional parameters for configuring the list.
|
22
22
|
def initialize(steps, current_step, options = {})
|
23
23
|
self.steps = steps
|
24
24
|
self.current_step = current_step
|
@@ -39,7 +39,7 @@ module Onboardable
|
|
39
39
|
# @return [Hash] The options hash for the list.
|
40
40
|
attr_reader :options
|
41
41
|
|
42
|
-
# Sets and validates
|
42
|
+
# Sets and validates an array of steps.
|
43
43
|
#
|
44
44
|
# @param steps [Array<Step>] The steps to be assigned to the list.
|
45
45
|
# @return [Array<Step>] The assigned steps.
|
@@ -58,7 +58,7 @@ module Onboardable
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
# Sets and validates
|
61
|
+
# Sets and validates options for the list.
|
62
62
|
#
|
63
63
|
# @param options [Hash] The options to be assigned to the list.
|
64
64
|
# @return [Hash] The assigned options.
|
@@ -59,9 +59,9 @@ module Onboardable
|
|
59
59
|
# @return [Hash] The options hash for the builder.
|
60
60
|
attr_reader :options
|
61
61
|
|
62
|
-
# Sets
|
62
|
+
# Sets options hash for the builder.
|
63
63
|
#
|
64
|
-
# @param options [Hash]
|
64
|
+
# @param options [Hash] Options to be set for the builder.
|
65
65
|
def options=(options)
|
66
66
|
@options = Hash(options).except(STEP_KEY)
|
67
67
|
end
|
@@ -91,7 +91,7 @@ module Onboardable
|
|
91
91
|
#
|
92
92
|
# @param name [String] The name of the step to be converted to a Step object.
|
93
93
|
# @return [Step] The corresponding Step object.
|
94
|
-
# @raise [StepError] Raises if the specified step name is not present in
|
94
|
+
# @raise [StepError] Raises if the specified step name is not present in steps hash.
|
95
95
|
def convert_to_step!(name)
|
96
96
|
steps[name] || raise(StepError.new(name, steps.keys))
|
97
97
|
end
|
data/lib/onboardable/step.rb
CHANGED
@@ -16,8 +16,8 @@ module Onboardable
|
|
16
16
|
class << self
|
17
17
|
# Attempts to convert a class to a Step object using a specified conversion method.
|
18
18
|
#
|
19
|
-
# @param klass [Class] The class to convert to a Step
|
20
|
-
# @return [Step, nil] The converted Step object, or nil if the class does not respond to the conversion method
|
19
|
+
# @param klass [Class] The class to convert to a Step.
|
20
|
+
# @return [Step, nil] The converted Step object, or nil if the class does not respond to the conversion method.
|
21
21
|
def try_convert(klass)
|
22
22
|
return unless klass.respond_to?(CONVERSION_METHOD)
|
23
23
|
|
@@ -30,26 +30,26 @@ module Onboardable
|
|
30
30
|
|
31
31
|
# Raises an error for a failed conversion attempt.
|
32
32
|
#
|
33
|
-
# @param klass [Class] The class that failed to convert
|
34
|
-
# @raise [StepConversionError] Raises an error for a failed conversion attempt
|
33
|
+
# @param klass [Class] The class that failed to convert.
|
34
|
+
# @raise [StepConversionError] Raises an error for a failed conversion attempt.
|
35
35
|
def conversion_error!(klass, step)
|
36
36
|
raise StepConversionError.new(klass, step)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
# @return [String] The name of the step
|
40
|
+
# @return [String] The name of the step.
|
41
41
|
attr_reader :name
|
42
42
|
|
43
|
-
# @return [Hash] Custom data associated with the step
|
43
|
+
# @return [Hash] Custom data associated with the step.
|
44
44
|
attr_reader :data
|
45
45
|
|
46
|
-
# @return [Symbol] The current status of the step
|
46
|
+
# @return [Symbol] The current status of the step.
|
47
47
|
attr_reader :status
|
48
48
|
|
49
49
|
# Initializes a new Step with a name, optional custom data, and a default status.
|
50
50
|
#
|
51
|
-
# @param name [String] The name of the step
|
52
|
-
# @param data [Hash] The custom data associated with the step
|
51
|
+
# @param name [String] The name of the step.
|
52
|
+
# @param data [Hash] The custom data associated with the step.
|
53
53
|
def initialize(name, data = {})
|
54
54
|
self.name = name
|
55
55
|
self.data = data
|
@@ -79,23 +79,23 @@ module Onboardable
|
|
79
79
|
|
80
80
|
# Compares this step to another to determine if they are equivalent, based on the step name.
|
81
81
|
#
|
82
|
-
# @param other [Step] The step to compare with
|
83
|
-
# @return [Boolean] True if both steps have the same name, false otherwise
|
82
|
+
# @param other [Step] The step to compare with.
|
83
|
+
# @return [Boolean] True if both steps have the same name, false otherwise.
|
84
84
|
def ==(other)
|
85
85
|
to_str == other.to_str
|
86
86
|
end
|
87
87
|
|
88
88
|
# Provides a string representation of the step, using its name.
|
89
89
|
#
|
90
|
-
# @return [String] The name of the step
|
90
|
+
# @return [String] The name of the step.
|
91
91
|
def to_str
|
92
92
|
name
|
93
93
|
end
|
94
94
|
|
95
95
|
# Updates the status of the step based on a specified comparison result.
|
96
96
|
#
|
97
|
-
# @param comparison_result [Integer] The result of a comparison
|
98
|
-
# @return [Symbol] The new status of the step
|
97
|
+
# @param comparison_result [Integer] The result of a comparison operation.
|
98
|
+
# @return [Symbol] The new status of the step.
|
99
99
|
def update_status!(comparison_result)
|
100
100
|
self.status = case comparison_result
|
101
101
|
when -1 then COMPLETED_STATUS
|
@@ -108,14 +108,14 @@ module Onboardable
|
|
108
108
|
|
109
109
|
# Sets the name of the step, ensuring it is a valid String.
|
110
110
|
#
|
111
|
-
# @param name [String] The raw name of the step
|
111
|
+
# @param name [String] The raw name of the step.
|
112
112
|
def name=(name)
|
113
113
|
@name = String.new(name).freeze
|
114
114
|
end
|
115
115
|
|
116
116
|
# Sets the status of the step.
|
117
117
|
#
|
118
|
-
# @param status [Symbol] The new status of the step
|
118
|
+
# @param status [Symbol] The new status of the step.
|
119
119
|
def status=(status)
|
120
120
|
STATUSES.include?(status) || raise(StepStatusError.new(status, STATUSES))
|
121
121
|
|
@@ -124,15 +124,15 @@ module Onboardable
|
|
124
124
|
|
125
125
|
# Sets the custom data for the step, ensuring it is a valid Hash.
|
126
126
|
#
|
127
|
-
# @param data [Hash] The raw custom data
|
127
|
+
# @param data [Hash] The raw custom data.
|
128
128
|
def data=(data)
|
129
129
|
@data = Hash(data).freeze
|
130
130
|
end
|
131
131
|
|
132
132
|
# Raises an error for an invalid comparison result.
|
133
133
|
#
|
134
|
-
# @param comparison_result [Integer] The invalid comparison result
|
135
|
-
# @raise [ComparisonResultError] Raises an error for an invalid comparison result
|
134
|
+
# @param comparison_result [Integer] The invalid comparison result.
|
135
|
+
# @raise [ComparisonResultError] Raises an error for an invalid comparison result.
|
136
136
|
def comparison_result_error!(comparison_result)
|
137
137
|
raise ComparisonResultError.new(comparison_result, (-1..1).to_a)
|
138
138
|
end
|
data/lib/onboardable/version.rb
CHANGED
data/onboardable.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = 'Provides tools for easy setup of custom onboarding to boost engagement.'
|
13
13
|
spec.homepage = 'https://github.com/dmrAnderson/onboardable'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = '>= 3.
|
15
|
+
spec.required_ruby_version = '>= 3.2.0'
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
18
18
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onboardable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Skrynnyk
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|
@@ -177,14 +177,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 3.
|
180
|
+
version: 3.2.0
|
181
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
183
|
- - ">="
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
|
-
rubygems_version: 3.6.
|
187
|
+
rubygems_version: 3.6.9
|
188
188
|
specification_version: 4
|
189
189
|
summary: Streamlines onboarding process integration
|
190
190
|
test_files: []
|