onboardable 1.5.0 → 1.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9f0c447b6d3593da8e840bc4964a61fb7078df687a13e0d87bf846d51c17838
4
- data.tar.gz: 5b0861f3ff6b98ed383d2497e4bca47bee0893ab98124e3bfd680c3b1e119dac
3
+ metadata.gz: 8f24682a34d8f84cf2eba4bdf9e69734bfa4788c7937d1b8b90b05456985b27b
4
+ data.tar.gz: c18c2ec8f27809b239c7ca8059522923bc511b3aebafaf732cc611244549d463
5
5
  SHA512:
6
- metadata.gz: 15c8e34a8d136da36ec0a8d968f6140123c5d05cece765e60ed1f95267416bf10373e4ea79159b84095e78485a691f3906a4897c15cb4b85ce377e3337c87b51
7
- data.tar.gz: dfdb3df40595dd49dc2860494bb9da050c8124f8e936f17ddd8c52a00626ac7576270d1cb4f793591f0d79277513079975d370a64c44504f5eda8151ed931944
6
+ metadata.gz: e443300f42828683e075ec62377ff4d3d43663c8c4e8609f9f17baf89b06b71c84fdda673939fa4fd86f487f192b7c6d65028b389cd790f3c196f6d8ad62e0a8
7
+ data.tar.gz: b8f14acd58e53891ef6de0f0c0b65181a354904ff27fd77940072641c680980ba99539012b12add6ae4395f42087416ed9f174b04168c12df6a0483414fd4f22
data/CHANGELOG.md CHANGED
@@ -1,70 +1,72 @@
1
1
  # CHANGELOG
2
2
 
3
- ## [Unreleased]
3
+ ## 1.6.0
4
4
 
5
- ## [1.5.0] - 2025-08-01
5
+ - Add support for Ruby 4.0.
6
+
7
+ ## 1.5.0
6
8
 
7
9
  - Drop support for Ruby 3.1.
8
10
  - Update development dependencies to their latest versions.
9
11
 
10
- ## [1.4.0] - 2025-04-01
12
+ ## 1.4.0
11
13
 
12
14
  - Add support for Ruby 3.4.
13
15
  - Drop support for Ruby 3.0.
14
16
 
15
- ## [1.3.3] - 2024-08-16
17
+ ## 1.3.3
16
18
 
17
19
  - Updated rbs files to improve type-checking.
18
20
  - Added github-actions package ecosystem to the development workflow.
19
21
 
20
- ## [1.3.2] - 2024-07-10
22
+ ## 1.3.2
21
23
 
22
24
  - Added adjustments to rbs files to improve type-checking.
23
25
 
24
- ## [1.3.1] - 2024-06-10
26
+ ## 1.3.1
25
27
 
26
28
  - Fixed the issue with the custom formula calculation.
27
29
 
28
- ## [1.3.0] - 2024-06-10
30
+ ## 1.3.0
29
31
 
30
- - Added option to calculate onboarding progress using a custom formula.
32
+ - Added an option to calculate onboarding progress using a custom formula.
31
33
 
32
- ## [1.2.2] - 2024-06-03
34
+ ## 1.2.2
33
35
 
34
36
  - Fixed the issue with the default `#current_step` method.
35
37
 
36
- ## [1.2.1] - 2024-06-01
38
+ ## 1.2.1
37
39
 
38
40
  - Added trusted publisher
39
41
 
40
- ## [1.2.0] - 2024-05-25
42
+ ## 1.2.0
41
43
 
42
44
  - Added `#second_step?` method to check if the target step is the second step.
43
45
  - Added `#prev_step?` method to check if the target step is the previous step.
44
46
  - Added `#current_step?` method to check if the target step is the current step.
45
47
 
46
- ## [1.1.1] - 2024-05-21
48
+ ## 1.1.1
47
49
 
48
50
  - Added `onboarding` class method to define the onboarding steps.
49
51
  - Added [documentation link](https://rubydoc.info/gems/onboardable) to gemspec.
50
52
 
51
- ## [1.1.0] - 2024-05-21
53
+ ## 1.1.0
52
54
 
53
55
  - Introduced `step_from` method for adding steps from external sources.
54
56
  - Added warn_about_override method to alert on step overrides.
55
57
  - Added YARD documentation to the project for improved code documentation.
56
58
 
57
- ## [1.0.1] - 2024-05-09
59
+ ## 1.0.1
58
60
 
59
61
  - Added `first_step` and `last_step` methods to easily access
60
62
  the boundaries of step lists.
61
63
  - Added `progress` method for calculating onboarding completion percentage.
62
64
 
63
- ## [1.0.0] - 2024-05-08
65
+ ## 1.0.0
64
66
 
65
67
  - Enhanced `first_step?` and `last_step?` methods to accept an optional argument,
66
68
  improving flexibility by allowing checks against any specified step.
67
69
 
68
- ## [0.1.0] - 2024-05-07
70
+ ## 0.1.0
69
71
 
70
72
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- onboardable (1.5.0)
4
+ onboardable (1.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -9,32 +9,32 @@ GEM
9
9
  ast (2.4.3)
10
10
  diff-lcs (1.6.2)
11
11
  docile (1.4.1)
12
- json (2.13.2)
12
+ json (2.18.0)
13
13
  language_server-protocol (3.17.0.5)
14
14
  lint_roller (1.1.0)
15
15
  parallel (1.27.0)
16
- parser (3.3.9.0)
16
+ parser (3.3.10.0)
17
17
  ast (~> 2.4.1)
18
18
  racc
19
- prism (1.4.0)
19
+ prism (1.7.0)
20
20
  racc (1.8.1)
21
21
  rainbow (3.1.1)
22
- rake (13.3.0)
23
- regexp_parser (2.10.0)
24
- rspec (3.13.1)
22
+ rake (13.3.1)
23
+ regexp_parser (2.11.3)
24
+ rspec (3.13.2)
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.4)
28
+ rspec-core (3.13.6)
29
29
  rspec-support (~> 3.13.0)
30
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.5)
33
+ rspec-mocks (3.13.6)
34
34
  diff-lcs (>= 1.2.0, < 2.0)
35
35
  rspec-support (~> 3.13.0)
36
- rspec-support (3.13.4)
37
- rubocop (1.79.1)
36
+ rspec-support (3.13.6)
37
+ rubocop (1.82.1)
38
38
  json (~> 2.3)
39
39
  language_server-protocol (~> 3.17.0.2)
40
40
  lint_roller (~> 1.1.0)
@@ -42,22 +42,22 @@ 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.46.0, < 2.0)
45
+ rubocop-ast (>= 1.48.0, < 2.0)
46
46
  ruby-progressbar (~> 1.7)
47
47
  unicode-display_width (>= 2.4.0, < 4.0)
48
- rubocop-ast (1.46.0)
48
+ rubocop-ast (1.48.0)
49
49
  parser (>= 3.3.7.2)
50
50
  prism (~> 1.4)
51
- rubocop-performance (1.25.0)
51
+ rubocop-performance (1.26.1)
52
52
  lint_roller (~> 1.1)
53
53
  rubocop (>= 1.75.0, < 2.0)
54
- rubocop-ast (>= 1.38.0, < 2.0)
54
+ rubocop-ast (>= 1.47.1, < 2.0)
55
55
  rubocop-rake (0.7.1)
56
56
  lint_roller (~> 1.1)
57
57
  rubocop (>= 1.72.1)
58
- rubocop-rspec (3.6.0)
58
+ rubocop-rspec (3.8.0)
59
59
  lint_roller (~> 1.1)
60
- rubocop (~> 1.72, >= 1.72.1)
60
+ rubocop (~> 1.81)
61
61
  ruby-progressbar (1.13.0)
62
62
  simplecov (0.22.0)
63
63
  docile (~> 1.1)
@@ -65,12 +65,17 @@ GEM
65
65
  simplecov_json_formatter (~> 0.1)
66
66
  simplecov-html (0.13.1)
67
67
  simplecov_json_formatter (0.1.4)
68
- unicode-display_width (3.1.4)
69
- unicode-emoji (~> 4.0, >= 4.0.4)
70
- unicode-emoji (4.0.4)
68
+ unicode-display_width (3.2.0)
69
+ unicode-emoji (~> 4.1)
70
+ unicode-emoji (4.2.0)
71
+ yard (0.9.38)
72
+ yard-lint (1.3.0)
73
+ yard (~> 0.9)
74
+ zeitwerk (~> 2.6)
75
+ zeitwerk (2.7.4)
71
76
 
72
77
  PLATFORMS
73
- x86_64-darwin-24
78
+ x86_64-darwin-25
74
79
  x86_64-linux
75
80
 
76
81
  DEPENDENCIES
@@ -82,6 +87,7 @@ DEPENDENCIES
82
87
  rubocop-rake (~> 0.7.1)
83
88
  rubocop-rspec (~> 3.0, >= 3.0.4)
84
89
  simplecov (~> 0.22.0)
90
+ yard-lint (~> 1.2, >= 1.2.3)
85
91
 
86
92
  BUNDLED WITH
87
- 2.7.1
93
+ 4.0.3
data/README.md CHANGED
@@ -251,4 +251,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
251
251
  ## 📜 Code of Conduct
252
252
 
253
253
  Everyone interacting with the Onboardable project's codebases, issue trackers,
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).
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).
@@ -20,7 +20,7 @@ module Onboardable
20
20
  # Initializes a new instance of StepConversionError.
21
21
  #
22
22
  # @param klass [Class] The class that failed to convert.
23
- # @param step [unknown] The object that was attempted to be converted to a Step.
23
+ # @param step [Object] The object that was attempted to be converted to a Step.
24
24
  def initialize(klass, step)
25
25
  super("Can't convert #{klass} to Step (#{klass}#to_onboarding_step gives #{step.class}).")
26
26
  end
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onboardable
4
+ # The List module encapsulates functionality for managing a sequence of onboarding steps.
4
5
  module List
5
6
  # The List class manages a sequence of steps in an onboarding process, tracking progress and current state.
6
7
  class Base
7
8
  include Navigation
8
9
 
10
+ # Default calculation for onboarding progress as a percentage.
9
11
  PROGRESS_CALCULATION = ->(step_index, steps_size) { (step_index.to_f / steps_size) * 100 }
10
12
 
11
13
  # @return [Array<Step>] The steps in the list.
@@ -19,6 +21,8 @@ module Onboardable
19
21
  # @param steps [Array<Step>] An array of steps comprising the onboarding process.
20
22
  # @param current_step [Step] The step currently active in the process.
21
23
  # @param options [Hash] Optional parameters for configuring the list.
24
+ # @option options [Proc] :progress_calculation A custom calculation for progress percentage.
25
+ # Receives step_index and steps_size as arguments and returns a Float.
22
26
  def initialize(steps, current_step, options = {})
23
27
  self.steps = steps
24
28
  self.current_step = current_step
@@ -61,6 +65,8 @@ module Onboardable
61
65
  # Sets and validates options for the list.
62
66
  #
63
67
  # @param options [Hash] The options to be assigned to the list.
68
+ # @option options [Proc] :progress_calculation A custom calculation for progress percentage.
69
+ # Receives step_index and steps_size as arguments and returns a Float.
64
70
  # @return [Hash] The assigned options.
65
71
  def options=(options)
66
72
  @options = Hash(options).transform_keys(&:to_sym).freeze
@@ -6,6 +6,7 @@ module Onboardable
6
6
  class Builder
7
7
  include Utils::Warnings
8
8
 
9
+ # Key used to store steps in the options hash.
9
10
  STEP_KEY = :steps
10
11
 
11
12
  # Stores the steps added to the builder.
@@ -19,6 +20,10 @@ module Onboardable
19
20
  attr_accessor :current_step
20
21
 
21
22
  # Initializes a new instance of ListBuilder.
23
+ #
24
+ # @param options [Hash] Options to be set for the builder.
25
+ # @option options [Proc] :progress_calculation A custom calculation for progress percentage.
26
+ # Receives step_index and steps_size as arguments and returns a Float.
22
27
  def initialize(options = {})
23
28
  self.options = options
24
29
  end
@@ -62,6 +67,8 @@ module Onboardable
62
67
  # Sets options hash for the builder.
63
68
  #
64
69
  # @param options [Hash] Options to be set for the builder.
70
+ # @option options [Proc] :progress_calculation A custom calculation for progress percentage.
71
+ # Receives step_index and steps_size as arguments and returns a Float.
65
72
  def options=(options)
66
73
  @options = Hash(options).except(STEP_KEY)
67
74
  end
@@ -3,14 +3,20 @@
3
3
  module Onboardable
4
4
  # Represents a single step within an onboarding process, including its status and associated data.
5
5
  class Step
6
+ # Method name used for converting a class to a Step object.
6
7
  CONVERSION_METHOD = :to_onboarding_step
7
8
 
9
+ # The step is pending and has not yet been started.
8
10
  PENDING_STATUS = :pending
11
+ # The step is currently in progress.
9
12
  CURRENT_STATUS = :current
13
+ # The step has been completed.
10
14
  COMPLETED_STATUS = :completed
11
15
 
16
+ # The default status for a new step.
12
17
  DEFAULT_STATUS = PENDING_STATUS
13
18
 
19
+ # All valid statuses for a step.
14
20
  STATUSES = [PENDING_STATUS, CURRENT_STATUS, COMPLETED_STATUS].freeze
15
21
 
16
22
  class << self
@@ -31,6 +37,7 @@ module Onboardable
31
37
  # Raises an error for a failed conversion attempt.
32
38
  #
33
39
  # @param klass [Class] The class that failed to convert.
40
+ # @param step [Object] The invalid object returned from the conversion method.
34
41
  # @raise [StepConversionError] Raises an error for a failed conversion attempt.
35
42
  def conversion_error!(klass, step)
36
43
  raise StepConversionError.new(klass, step)
@@ -101,7 +108,8 @@ module Onboardable
101
108
  when -1 then COMPLETED_STATUS
102
109
  when 0 then CURRENT_STATUS
103
110
  when 1 then PENDING_STATUS
104
- else comparison_result_error!(comparison_result); end
111
+ else comparison_result_error!(comparison_result)
112
+ end
105
113
  end
106
114
 
107
115
  private
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onboardable
4
+ # The Utils module contains utility classes and modules for the Onboardable namespace.
4
5
  module Utils
5
6
  # The Warnings module provides utility methods for issuing warnings.
6
7
  module Warnings
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onboardable
4
- VERSION = '1.5.0'
4
+ # The version of the Onboardable gem.
5
+ VERSION = '1.6.0'
5
6
  end
data/lib/onboardable.rb CHANGED
@@ -13,7 +13,7 @@ module Onboardable
13
13
  # Initializes the Onboardable module when included in a class, extending it with class and instance methods.
14
14
  #
15
15
  # @param klass [Module] The class including the Onboardable module
16
- # @return [untyped] The class including the Onboardable module.
16
+ # @return [void]
17
17
  def self.included(klass)
18
18
  klass.extend ClassMethods
19
19
  klass.include InstanceMethods
@@ -27,6 +27,8 @@ module Onboardable
27
27
  # Configures onboarding steps via a ListBuilder with a provided block.
28
28
  #
29
29
  # @param options [Hash] Optional configuration options for the ListBuilder.
30
+ # @option options [Proc] :progress_calculation A custom calculation for progress percentage.
31
+ # Receives step_index and steps_size as arguments and returns a Float.
30
32
  # @yield [List::Builder] Executes block in the context of List::Builder.
31
33
  # @return [Step] The current step in the building process.
32
34
  def onboarding=(options = {}, &)
data/onboardable.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
27
  spec.files = Dir.chdir(__dir__) do
28
28
  `git ls-files -z`.split("\x0").reject do |f|
29
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|spec)/|\.(?:git|rspec|rubocop))})
29
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|spec)/|\.(?:git|rspec|rubocop|yard))})
30
30
  end
31
31
  end
32
32
 
@@ -46,6 +46,7 @@ Gem::Specification.new do |spec|
46
46
  spec.add_development_dependency 'rubocop-rake', '~> 0.7.1'
47
47
  spec.add_development_dependency 'rubocop-rspec', '~> 3.0', '>= 3.0.4'
48
48
  spec.add_development_dependency 'simplecov', '~> 0.22.0'
49
+ spec.add_development_dependency 'yard-lint', '~> 1.2', '>= 1.2.3'
49
50
 
50
51
  spec.metadata['rubygems_mfa_required'] = 'true'
51
52
  end
@@ -7,7 +7,7 @@ module Onboardable
7
7
  end
8
8
 
9
9
  class StepConversionError < Error
10
- def initialize: (Class klass, untyped step) -> untyped
10
+ def initialize: (Class klass, Object step) -> untyped
11
11
  end
12
12
 
13
13
  class EmptyStepsError < Error
data/sig/onboardable.rbs CHANGED
@@ -1,7 +1,7 @@
1
1
  module Onboardable
2
2
  VERSION: String
3
3
 
4
- def self.included: (Class klass) -> untyped
4
+ def self.included: (Module klass) -> void
5
5
 
6
6
  module ClassMethods
7
7
  attr_accessor list_builder: List::Builder
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.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Skrynnyk
@@ -131,6 +131,26 @@ dependencies:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
133
  version: 0.22.0
134
+ - !ruby/object:Gem::Dependency
135
+ name: yard-lint
136
+ requirement: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: '1.2'
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: 1.2.3
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '1.2'
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: 1.2.3
134
154
  description: Provides tools for easy setup of custom onboarding to boost engagement.
135
155
  email:
136
156
  - skrynnyk.artem@coaxsoft.com
@@ -184,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
204
  - !ruby/object:Gem::Version
185
205
  version: '0'
186
206
  requirements: []
187
- rubygems_version: 3.6.9
207
+ rubygems_version: 4.0.3
188
208
  specification_version: 4
189
209
  summary: Streamlines onboarding process integration
190
210
  test_files: []