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

Make abstractions in Util more ruby-friendly #11

Closed
ffloyd opened this issue Apr 23, 2020 · 0 comments · Fixed by #13
Closed

Make abstractions in Util more ruby-friendly #11

ffloyd opened this issue Apr 23, 2020 · 0 comments · Fixed by #13
Assignees
Labels
enhancement New feature or request

Comments

@ffloyd
Copy link
Owner

ffloyd commented Apr 23, 2020

The problem

Right now modules under Flows::Util work like "module patchers":

module YourModule
  SomeStuffFromUtils.call(self, opts)
end

I see this code as a very confusing one for an average Ruby developer.

The solution

In my opinion, the more ruby-friendly and less confusing way will be "module factory":

MyBehaviour = SomeStuffFromUtil.make_module(opts)

module YourModule
  extend MyBehaviour
end

Also, more condensed way of usage is possible:

module YourModule
  extend SomeStuffFromUtil.make_module(opts)
end

But in this way, you'll have an anonymous module which can be inconvenient for backtrace readers and YARD documentation tool.

And it will be convenient if an error will be raised if you're including generated module instead of extending and vise versa.

@ffloyd ffloyd added the enhancement New feature or request label Apr 23, 2020
@ffloyd ffloyd self-assigned this Apr 23, 2020
ffloyd added a commit that referenced this issue Apr 28, 2020
ffloyd added a commit that referenced this issue Apr 28, 2020
ffloyd added a commit that referenced this issue Apr 28, 2020
* refactor!(#11): simplify PrependToClass API

* refactor!(#11): simplify DupStrategy

* refactor!(#11): simplify IsolationStrategy

* docs(#11): update CHANGELOG
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