Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow defining Queue Mode hooks multiple times (before_queue, after_subset_queue, after_queue) #122

Merged
merged 5 commits into from
Sep 2, 2020

Conversation

ArturT
Copy link
Member

@ArturT ArturT commented Sep 2, 2020

Allow defining multiple times hooks for Queue Mode like

  • KnapsackPro::Hooks::Queue.before_queue
  • KnapsackPro::Hooks::Queue.after_subset_queue
  • KnapsackPro::Hooks::Queue.after_queue

why

So far you could define only once a hook for Queue Mode. This might be less convenient when you would like to keep hooks related code in a few separate files.

change

You can now define multiple times the same hook. Example:

KnapsackPro::Hooks::Queue.before_queue do
  puts '1st call'
end

KnapsackPro::Hooks::Queue.before_queue do
  puts '2nd call'
end

This works similarly to hooks in RSpec so you can define them many times.

Here are examples of using all hooks in Queue Mode:
https://github.com/KnapsackPro/knapsack_pro-ruby#what-hooks-are-supported-in-queue-mode

…@before_queue_store to avoid bug with self calling setter and adding nil to array
@ArturT ArturT merged commit 0876fc8 into master Sep 2, 2020
@ArturT ArturT deleted the multiple-hooks-call branch September 2, 2020 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant