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

Improve Micro::Case internal steps [NEW FEATURE] #61

Closed
2 tasks done
serradura opened this issue Aug 10, 2020 · 0 comments · Fixed by #66
Closed
2 tasks done

Improve Micro::Case internal steps [NEW FEATURE] #61

serradura opened this issue Aug 10, 2020 · 0 comments · Fixed by #66
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@serradura
Copy link
Owner

serradura commented Aug 10, 2020

  • Support Method instances as an alternative to lambdas. Use Method#arity to define when it will receive or not the result #data values.

Micro::Case::Result#then

class ContractaTemplate::Update < Micro::Case
  attributes :params, :contract_template
  
  def call!
    find
      .then(method(:validate))
      .then(method(:persist))
      .then(method(:create_revision), some: :hash)
  end
end

Micro::Case::Result#|

class ContractaTemplate::Update < Micro::Case
  attributes :params, :contract_template
  
  def call!
    find \
      | method(:validate) \
      | method(:persist)  \
      | method(:create_revision)
  end
end
  • Make the Micro::Case::Result#then accumulates the data when receiving a lambda or a method instance.

Thanks, @josuetex, @lunks for helping me to elaborate on this idea. 👏

@serradura serradura added the enhancement New feature or request label Aug 10, 2020
@serradura serradura added this to the 3.0.0 milestone Aug 10, 2020
@serradura serradura self-assigned this Aug 12, 2020
@serradura serradura changed the title Improve Micro::Case::Result#then Improve Micro::Case internal methods Aug 12, 2020
@serradura serradura changed the title Improve Micro::Case internal methods Improve Micro::Case internal methods [NEW FEATURE] Aug 12, 2020
@serradura serradura changed the title Improve Micro::Case internal methods [NEW FEATURE] Improve Micro::Case internal flow [NEW FEATURE] Aug 12, 2020
@serradura serradura changed the title Improve Micro::Case internal flow [NEW FEATURE] Improve Micro::Case internal steps [NEW FEATURE] Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant