QNester/methodist

View on GitHub
lib/generators/interactor/templates/interactor.erb

Summary

Maintainability
Test Coverage
<% unless options['clean'] -%>
# Methodist interactors use dry-transaction.
# Check docs here: https://github.com/dry-rb/dry-transaction
<% end -%>
class <%= name.camelcase %> < <%= options['parent'] %>
  <% unless options['skip-validations'] %>
  # See here the syntax for validation http://dry-rb.org/gems/dry-validation/
  schema do
    # required(:name).value(:str?)
  end
  <% end %>
  <% unless options['clean'] -%>
  # Use your step, tee, try or map
  # More info: http://dry-rb.org/gems/dry-transaction/step-adapters/
  <% end -%>
  <%- unless options['skip-validations'] %>
  step :validate
  <%- end -%>
  <%- unless options['clean'] -%>
  # step :do_something
  <%- end %>
end