Skip to content

Commit

Permalink
document changes
Browse files Browse the repository at this point in the history
  • Loading branch information
markburns committed Jul 2, 2024
1 parent 7318128 commit f880222
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## [Unreleased]
- Add support for `Interactify.with(queue: 'within_30_seconds', retry: 3)`

## [0.5.0] - 2024-01-01
- Add support for `SetA = Interactify { _1.a = 'a' }`, lambda and block class creation syntax
Expand Down
17 changes: 14 additions & 3 deletions lib/interactify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ def included(base)
# expect :foo
# end
#
# ExampleInteractor::Job is a class availabe to be used in a sidekiq yaml file
# ExampleInteractor::Async.call(foo: 'bar') # uses the within_30_seconds queue
# creates
# - ExampleInteractor::InteractifyWithOptions
# - ExampleInteractor::JobWith__Queue_Within30Seconds__Retries_3
# - ExampleInteractor::Job (an alias of above)
# - ExampleInteractor::AsyncWith__Queue_Within30Seconds__Retries_3
# - ExampleInteractor::Async (an alias of above)
def with(receiver, sidekiq_opts = {})
sidekiq_opts = sidekiq_opts.symbolize_keys
klass_name = Async::JobMaker::VALID_KEYS.map do |key|
Expand All @@ -57,15 +61,22 @@ def with(receiver, sidekiq_opts = {})

receiver.const_set(:InteractifyWithOptions, Module.new)
mod = receiver.const_get(:InteractifyWithOptions)
job_klass = nil
async_klass = nil

Check warning on line 65 in lib/interactify.rb

View check run for this annotation

Codecov / codecov/patch

lib/interactify.rb#L62-L65

Added lines #L62 - L65 were not covered by tests

mod.instance_eval do
define_singleton_method :included do |base|
base.include Interactify::Core
base.include Interactify::Async::Jobable

Check warning on line 70 in lib/interactify.rb

View check run for this annotation

Codecov / codecov/patch

lib/interactify.rb#L67-L70

Added lines #L67 - L70 were not covered by tests

base.interactor_job(opts: sidekiq_opts, klass_suffix:)
job_klass = base.interactor_job(opts: sidekiq_opts, klass_suffix:)
async_klass = base::Async.const_get("Async#{klass_suffix}")

Check warning on line 73 in lib/interactify.rb

View check run for this annotation

Codecov / codecov/patch

lib/interactify.rb#L72-L73

Added lines #L72 - L73 were not covered by tests
end
end

receiver.const_set("Job", job_klass)
receiver.const_set("Async", async_klass)

Check warning on line 78 in lib/interactify.rb

View check run for this annotation

Codecov / codecov/patch

lib/interactify.rb#L77-L78

Added lines #L77 - L78 were not covered by tests

mod

Check warning on line 80 in lib/interactify.rb

View check run for this annotation

Codecov / codecov/patch

lib/interactify.rb#L80

Added line #L80 was not covered by tests
end
end
Expand Down

0 comments on commit f880222

Please sign in to comment.