Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Re-open Interactor and add method to validate context
module Interactor
def require_in_context(*names)
context_keys = context.keys
names.each do |name|
if !context_keys.include?(name)
raise "Interactor #{self.class.name} requires #{name.inspect} but it wasn't found in context."
end
end
names.map do |name|
self.send(name)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.