job-iteration 1.10.0 → 1.12.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.
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at shatrov@me.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
-
7
- # Specify your gem's dependencies in job-iteration.gemspec
8
- gemspec
9
-
10
- # for integration testing
11
- gem "sidekiq"
12
- gem "resque"
13
- gem "delayed_job"
14
-
15
- if defined?(@rails_gems_requirements) && @rails_gems_requirements
16
- # We avoid the `gem "..."` syntax here so Dependabot doesn't try to update these gems.
17
- [
18
- "activejob",
19
- "activerecord",
20
- "railties",
21
- ].each { |name| gem name, @rails_gems_requirements }
22
- else
23
- # gem "activejob" # Set in gemspec
24
- gem "activerecord"
25
- gem "railties"
26
- end
27
-
28
- gem "mysql2", github: "brianmario/mysql2"
29
- gem "globalid"
30
- gem "i18n"
31
- gem "redis"
32
-
33
- gem "pry"
34
- gem "mocha"
35
-
36
- gem "rubocop-shopify", require: false
37
- gem "yard"
38
- gem "rake"
39
- gem "csv" # required for Ruby 3.4+
40
-
41
- # for unit testing optional sorbet support
42
- gem "sorbet-runtime"
43
- gem "tapioca"
44
-
45
- gem "logger"
data/Gemfile.lock DELETED
@@ -1,266 +0,0 @@
1
- GIT
2
- remote: https://github.com/brianmario/mysql2
3
- revision: 57b8df188c963ae0e4d4e1123d3e9de2bbcab637
4
- specs:
5
- mysql2 (0.5.6)
6
- bigdecimal
7
-
8
- PATH
9
- remote: .
10
- specs:
11
- job-iteration (1.10.0)
12
- activejob (>= 6.1)
13
-
14
- GEM
15
- remote: https://rubygems.org/
16
- specs:
17
- actionpack (8.0.1)
18
- actionview (= 8.0.1)
19
- activesupport (= 8.0.1)
20
- nokogiri (>= 1.8.5)
21
- rack (>= 2.2.4)
22
- rack-session (>= 1.0.1)
23
- rack-test (>= 0.6.3)
24
- rails-dom-testing (~> 2.2)
25
- rails-html-sanitizer (~> 1.6)
26
- useragent (~> 0.16)
27
- actionview (8.0.1)
28
- activesupport (= 8.0.1)
29
- builder (~> 3.1)
30
- erubi (~> 1.11)
31
- rails-dom-testing (~> 2.2)
32
- rails-html-sanitizer (~> 1.6)
33
- activejob (8.0.1)
34
- activesupport (= 8.0.1)
35
- globalid (>= 0.3.6)
36
- activemodel (8.0.1)
37
- activesupport (= 8.0.1)
38
- activerecord (8.0.1)
39
- activemodel (= 8.0.1)
40
- activesupport (= 8.0.1)
41
- timeout (>= 0.4.0)
42
- activesupport (8.0.1)
43
- base64
44
- benchmark (>= 0.3)
45
- bigdecimal
46
- concurrent-ruby (~> 1.0, >= 1.3.1)
47
- connection_pool (>= 2.2.5)
48
- drb
49
- i18n (>= 1.6, < 2)
50
- logger (>= 1.4.2)
51
- minitest (>= 5.1)
52
- securerandom (>= 0.3)
53
- tzinfo (~> 2.0, >= 2.0.5)
54
- uri (>= 0.13.1)
55
- ast (2.4.2)
56
- base64 (0.2.0)
57
- benchmark (0.4.0)
58
- bigdecimal (3.1.9)
59
- builder (3.3.0)
60
- coderay (1.1.3)
61
- concurrent-ruby (1.3.5)
62
- connection_pool (2.5.0)
63
- crass (1.0.6)
64
- csv (3.3.2)
65
- date (3.4.1)
66
- delayed_job (4.1.13)
67
- activesupport (>= 3.0, < 9.0)
68
- drb (2.2.1)
69
- erubi (1.13.1)
70
- globalid (1.2.1)
71
- activesupport (>= 6.1)
72
- i18n (1.14.7)
73
- concurrent-ruby (~> 1.0)
74
- io-console (0.8.0)
75
- irb (1.15.1)
76
- pp (>= 0.6.0)
77
- rdoc (>= 4.0.0)
78
- reline (>= 0.4.2)
79
- json (2.10.1)
80
- language_server-protocol (3.17.0.4)
81
- lint_roller (1.1.0)
82
- logger (1.6.6)
83
- loofah (2.24.0)
84
- crass (~> 1.0.2)
85
- nokogiri (>= 1.12.0)
86
- method_source (1.1.0)
87
- minitest (5.25.4)
88
- mocha (2.7.1)
89
- ruby2_keywords (>= 0.0.5)
90
- mono_logger (1.1.2)
91
- multi_json (1.15.0)
92
- mustermann (3.0.3)
93
- ruby2_keywords (~> 0.0.1)
94
- netrc (0.11.0)
95
- nokogiri (1.18.3-arm64-darwin)
96
- racc (~> 1.4)
97
- nokogiri (1.18.3-x86_64-darwin)
98
- racc (~> 1.4)
99
- nokogiri (1.18.3-x86_64-linux-gnu)
100
- racc (~> 1.4)
101
- parallel (1.26.3)
102
- parser (3.3.7.1)
103
- ast (~> 2.4.1)
104
- racc
105
- pp (0.6.2)
106
- prettyprint
107
- prettyprint (0.2.0)
108
- prism (1.3.0)
109
- pry (0.15.2)
110
- coderay (~> 1.1)
111
- method_source (~> 1.0)
112
- psych (5.2.3)
113
- date
114
- stringio
115
- racc (1.8.1)
116
- rack (3.1.12)
117
- rack-protection (4.1.1)
118
- base64 (>= 0.1.0)
119
- logger (>= 1.6.0)
120
- rack (>= 3.0.0, < 4)
121
- rack-session (2.1.0)
122
- base64 (>= 0.1.0)
123
- rack (>= 3.0.0)
124
- rack-test (2.2.0)
125
- rack (>= 1.3)
126
- rackup (2.2.1)
127
- rack (>= 3)
128
- rails-dom-testing (2.2.0)
129
- activesupport (>= 5.0.0)
130
- minitest
131
- nokogiri (>= 1.6)
132
- rails-html-sanitizer (1.6.2)
133
- loofah (~> 2.21)
134
- nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
135
- railties (8.0.1)
136
- actionpack (= 8.0.1)
137
- activesupport (= 8.0.1)
138
- irb (~> 1.13)
139
- rackup (>= 1.0.0)
140
- rake (>= 12.2)
141
- thor (~> 1.0, >= 1.2.2)
142
- zeitwerk (~> 2.6)
143
- rainbow (3.1.1)
144
- rake (13.2.1)
145
- rbi (0.3.0)
146
- prism (~> 1.0)
147
- rbs (>= 3.4.4)
148
- sorbet-runtime (>= 0.5.9204)
149
- rbs (3.8.1)
150
- logger
151
- rdoc (6.12.0)
152
- psych (>= 4.0.0)
153
- redis (5.4.0)
154
- redis-client (>= 0.22.0)
155
- redis-client (0.24.0)
156
- connection_pool
157
- redis-namespace (1.11.0)
158
- redis (>= 4)
159
- regexp_parser (2.10.0)
160
- reline (0.6.0)
161
- io-console (~> 0.5)
162
- resque (2.7.0)
163
- mono_logger (~> 1)
164
- multi_json (~> 1.0)
165
- redis-namespace (~> 1.6)
166
- sinatra (>= 0.9.2)
167
- rubocop (1.73.2)
168
- json (~> 2.3)
169
- language_server-protocol (~> 3.17.0.2)
170
- lint_roller (~> 1.1.0)
171
- parallel (~> 1.10)
172
- parser (>= 3.3.0.2)
173
- rainbow (>= 2.2.2, < 4.0)
174
- regexp_parser (>= 2.9.3, < 3.0)
175
- rubocop-ast (>= 1.38.0, < 2.0)
176
- ruby-progressbar (~> 1.7)
177
- unicode-display_width (>= 2.4.0, < 4.0)
178
- rubocop-ast (1.38.1)
179
- parser (>= 3.3.1.0)
180
- rubocop-shopify (2.16.0)
181
- rubocop (~> 1.62)
182
- ruby-progressbar (1.13.0)
183
- ruby2_keywords (0.0.5)
184
- securerandom (0.4.1)
185
- sidekiq (8.0.1)
186
- connection_pool (>= 2.5.0)
187
- json (>= 2.9.0)
188
- logger (>= 1.6.2)
189
- rack (>= 3.1.0)
190
- redis-client (>= 0.23.2)
191
- sinatra (4.1.1)
192
- logger (>= 1.6.0)
193
- mustermann (~> 3.0)
194
- rack (>= 3.0.0, < 4)
195
- rack-protection (= 4.1.1)
196
- rack-session (>= 2.0.0, < 3)
197
- tilt (~> 2.0)
198
- sorbet (0.5.11915)
199
- sorbet-static (= 0.5.11915)
200
- sorbet-runtime (0.5.11915)
201
- sorbet-static (0.5.11915-universal-darwin)
202
- sorbet-static (0.5.11915-x86_64-linux)
203
- sorbet-static-and-runtime (0.5.11915)
204
- sorbet (= 0.5.11915)
205
- sorbet-runtime (= 0.5.11915)
206
- spoom (1.6.0)
207
- erubi (>= 1.10.0)
208
- prism (>= 0.28.0)
209
- rbi (>= 0.2.3)
210
- sorbet-static-and-runtime (>= 0.5.10187)
211
- thor (>= 0.19.2)
212
- stringio (3.1.5)
213
- tapioca (0.16.11)
214
- benchmark
215
- bundler (>= 2.2.25)
216
- netrc (>= 0.11.0)
217
- parallel (>= 1.21.0)
218
- rbi (~> 0.2)
219
- sorbet-static-and-runtime (>= 0.5.11087)
220
- spoom (>= 1.2.0)
221
- thor (>= 1.2.0)
222
- yard-sorbet
223
- thor (1.3.2)
224
- tilt (2.6.0)
225
- timeout (0.4.3)
226
- tzinfo (2.0.6)
227
- concurrent-ruby (~> 1.0)
228
- unicode-display_width (3.1.4)
229
- unicode-emoji (~> 4.0, >= 4.0.4)
230
- unicode-emoji (4.0.4)
231
- uri (1.0.3)
232
- useragent (0.16.11)
233
- yard (0.9.37)
234
- yard-sorbet (0.9.0)
235
- sorbet-runtime
236
- yard
237
- zeitwerk (2.7.2)
238
-
239
- PLATFORMS
240
- arm64-darwin
241
- x86_64-darwin
242
- x86_64-linux
243
-
244
- DEPENDENCIES
245
- activerecord
246
- csv
247
- delayed_job
248
- globalid
249
- i18n
250
- job-iteration!
251
- logger
252
- mocha
253
- mysql2!
254
- pry
255
- railties
256
- rake
257
- redis
258
- resque
259
- rubocop-shopify
260
- sidekiq
261
- sorbet-runtime
262
- tapioca
263
- yard
264
-
265
- BUNDLED WITH
266
- 2.6.1
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rake/testtask"
5
-
6
- Rake::TestTask.new(:test) do |t|
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/*_test.rb"]
10
- end
11
-
12
- task(default: :test)
data/bin/setup DELETED
@@ -1,23 +0,0 @@
1
- #!/bin/bash
2
-
3
- if ! [ -x "$(command -v mysql)" ];
4
- then
5
- echo "Error: mysql is not installed." >&2
6
- echo "You need to install mysql"
7
- exit 1
8
- else
9
- echo "Installing dependencies"
10
- bundle install --quiet
11
-
12
- mysql.server start > /dev/null 2>&1
13
- mysql -uroot job_iteration_test -e exit > /dev/null 2>&1
14
-
15
- if [ $? -eq 0 ];
16
- then
17
- echo "Setup completed!"
18
- else
19
- echo "Creating job_iteration_test database"
20
- mysql -uroot -e "CREATE DATABASE job_iteration_test" > /dev/null 2>&1
21
- echo "Setup completed!"
22
- fi
23
- fi
data/bin/test DELETED
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- def main
5
- begin
6
- command = create_command
7
- rescue ArgumentError => e
8
- abort(e.message)
9
- end
10
- puts "Running #{command.join(" ")}"
11
- system(*command)
12
- end
13
-
14
- def create_command
15
- case ARGV.length
16
- when 0
17
- ["bundle", "exec", "rake", "test"]
18
- when 1
19
- filename = ARGV[0]
20
- ["bundle", "exec", "rake", "test", "TEST=#{filename}"]
21
- when 2
22
- filename = ARGV[0]
23
- test_name = ARGV[1]
24
- test_name_with_underscores = test_name.tr(" ", "_")
25
- test_name_pattern = "/#{Regexp.escape(test_name_with_underscores)}/"
26
- ["bundle", "exec", "rake", "test", "TEST=#{filename}", "TESTOPTS=\"--name=#{test_name_pattern} -v\""]
27
- else
28
- raise ArgumentError, "Too many arguments. Did you forget to put the test name in quotes?"
29
- end
30
- end
31
-
32
- main
data/dev.yml DELETED
@@ -1,54 +0,0 @@
1
- # This file is for Shopify employees development environment.
2
- # If you are an external contributor you don't have to bother with it.
3
- name: job-iteration
4
-
5
- up:
6
- - packages:
7
- - mysql_client
8
- - ruby
9
- - bundler
10
- - mysql
11
- - redis
12
- - custom:
13
- name: Create Job Iteration database
14
- meet: mysql -uroot -h $MYSQL_HOST -P $MYSQL_PORT -e "CREATE DATABASE job_iteration_test"
15
- met?: mysql -uroot -h $MYSQL_HOST -P $MYSQL_PORT job_iteration_test -e "SELECT 1" &> /dev/null
16
-
17
- commands:
18
- test:
19
- run: bin/test "$@"
20
- syntax:
21
- optional: filename testnamepattern
22
- aliases: [t]
23
- desc: run tests
24
- long_desc: |
25
- {{bold:Default}}
26
- =======
27
- Run the entire test suite.
28
-
29
- Examples:
30
- {{command:dev test}}
31
- {{command:dev t}}
32
-
33
- {{bold:Run all tests in a file}}
34
- ========================
35
- Include the file path.
36
-
37
- Example:
38
- {{command:dev test test/unit/iteration_test.rb}}
39
-
40
- {{bold:Run a single test in a given file}}
41
- ========================
42
- Include the file path and the name of the test you'd like to run.
43
-
44
- Example:
45
- {{command:dev test test/unit/iteration_test.rb test_that_it_has_a_version_number}}
46
-
47
- {{bold:Run all tests in a given file whose name contains a string}}
48
- ========================
49
- Include the file path and the string that the test names should contain.
50
-
51
- Example:
52
- {{command:dev test test/unit/iteration_test.rb version_number}}
53
- style:
54
- run: bundle exec rubocop -a
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- rails_version = ENV.fetch("RAILS_VERSION")
4
- @rails_gems_requirements = case rails_version
5
- when "edge" then { github: "rails/rails", branch: "main" }
6
- when /\A\d+\.\d+\z/ then "~> #{rails_version}.0"
7
- else raise "Unsupported RAILS_VERSION: #{rails_version}"
8
- end
9
-
10
- eval_gemfile "../Gemfile"
11
-
12
- # https://github.com/rails/rails/pull/44083
13
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1") &&
14
- rails_version != "edge" && Gem::Version.new(rails_version) < Gem::Version.new("7")
15
- gem "net-imap", require: false
16
- gem "net-pop", require: false
17
- gem "net-smtp", require: false
18
- end
@@ -1,128 +0,0 @@
1
- `job-iteration` overrides the `perform` method of `ActiveJob::Base` to allow for iteration. The `perform` method preserves all the standard calling conventions of the original, but the way the subsequent methods work might differ from what one expects from an ActiveJob subclass.
2
-
3
- The call sequence is usually 3 methods:
4
-
5
- `perform -> build_enumerator -> each_iteration|each_batch`
6
-
7
- In that sense `job-iteration` works like a framework (it calls your code) rather than like a library (that you call). When using jobs with parameters, the following rules of thumb are good to keep in mind.
8
-
9
- ### Jobs without arguments
10
-
11
- Jobs without arguments do not pass anything into either `build_enumerator` or `each_iteration` except for the `cursor` which `job-iteration` persists by itself:
12
-
13
- ```ruby
14
- class ArglessJob < ActiveJob::Base
15
- include JobIteration::Iteration
16
-
17
- def build_enumerator(cursor:)
18
- # ...
19
- end
20
-
21
- def each_iteration(single_object_yielded_from_enumerator)
22
- # ...
23
- end
24
- end
25
- ```
26
-
27
- To enqueue the job:
28
-
29
- ```ruby
30
- ArglessJob.perform_later
31
- ```
32
-
33
- ### Jobs with positional arguments
34
-
35
- Jobs with positional arguments will have those arguments available to both `build_enumerator` and `each_iteration`:
36
-
37
- ```ruby
38
- class ArgumentativeJob < ActiveJob::Base
39
- include JobIteration::Iteration
40
-
41
- def build_enumerator(arg1, arg2, arg3, cursor:)
42
- # ...
43
- end
44
-
45
- def each_iteration(single_object_yielded_from_enumerator, arg1, arg2, arg3)
46
- # ...
47
- end
48
- end
49
- ```
50
-
51
- To enqueue the job:
52
-
53
- ```ruby
54
- ArgumentativeJob.perform_later(_arg1 = "One", _arg2 = "Two", _arg3 = "Three")
55
- ```
56
-
57
- ### Jobs with keyword arguments
58
-
59
- Jobs with keyword arguments will have the keyword arguments available to both `build_enumerator` and `each_iteration`, but these arguments come packaged into a Hash in both cases. You will need to `fetch` or `[]` your parameter from the `Hash` you get passed in:
60
-
61
- ```ruby
62
- class ParameterizedJob < ActiveJob::Base
63
- include JobIteration::Iteration
64
-
65
- def build_enumerator(kwargs, cursor:)
66
- name = kwargs.fetch(:name)
67
- email = kwargs.fetch(:email)
68
- # ...
69
- end
70
-
71
- def each_iteration(object_yielded_from_enumerator, kwargs)
72
- name = kwargs.fetch(:name)
73
- email = kwargs.fetch(:email)
74
- # ...
75
- end
76
- end
77
- ```
78
-
79
- To enqueue the job:
80
-
81
- ```ruby
82
- ParameterizedJob.perform_later(name: "Jane", email: "jane@host.example")
83
- ```
84
-
85
- Note that you cannot use `ruby2_keywords` at present, and the keyword arguments syntax is not supported in `each_iteration` / `build_enumerator`.
86
-
87
- ### Jobs with both positional and keyword arguments
88
-
89
- Jobs with keyword arguments will have the keyword arguments available to both `build_enumerator` and `each_iteration`, but these arguments come packaged into a Hash in both cases. You will need to `fetch` or `[]` your parameter from the `Hash` you get passed in. Positional arguments get passed first and "unsplatted" (not combined into an array), the `Hash` containing keyword arguments comes after:
90
-
91
- ```ruby
92
- class HighlyConfigurableGreetingJob < ActiveJob::Base
93
- include JobIteration::Iteration
94
-
95
- def build_enumerator(subject_line, kwargs, cursor:)
96
- name = kwargs.fetch(:sender_name)
97
- email = kwargs.fetch(:sender_email)
98
- # ...
99
- end
100
-
101
- def each_iteration(object_yielded_from_enumerator, subject_line, kwargs)
102
- name = kwargs.fetch(:sender_name)
103
- email = kwargs.fetch(:sender_email)
104
- # ...
105
- end
106
- end
107
- ```
108
-
109
- To enqueue the job:
110
-
111
- ```ruby
112
- HighlyConfigurableGreetingJob.perform_later(_subject_line = "Greetings everybody!", sender_name: "Jane", sender_email: "jane@host.example")
113
- ```
114
-
115
- Note that you cannot use `ruby2_keywords` at present, and the keyword arguments syntax is not supported in `each_iteration` / `build_enumerator`.
116
-
117
- ### Returning (yielding) from enumerators
118
-
119
- When defining a custom enumerator (see the [custom enumerator guide](custom-enumerator.md)) you need to yield two positional arguments from it: the object that will be the value for the current iteration (like a single ActiveModel instance, a single number...) and the value you want to be persisted as the `cursor` value should `job-iteration` decide to interrupt you after this iteration. Calling the enumerator with that cursor should return the next object after the one returned in this iteration. That new `cursor` value does not get passed to `each_iteration`:
120
-
121
- ```ruby
122
- Enumerator.new do |yielder|
123
- # In this case `cursor` is an Integer
124
- cursor.upto(99999) do |offset|
125
- yielder.yield(fetch_record_at(offset), offset)
126
- end
127
- end
128
- ```