barsoom / attr_extras

Takes some boilerplate out of Ruby with methods like attr_initialize.
MIT License
560 stars 31 forks source link

Keyword argument defaults #25

Closed DamirSvrtan closed 5 years ago

DamirSvrtan commented 6 years ago

Hi! 👋

Thank you for creating this library, I've been using it for over a year on most of the stuff I do and it has been great! (99% of time basically using the method object).

I've wanted to ask you, is there an option to pass default values to keyword arguments on method objects?

henrik commented 6 years ago

Hi! Thank you so much! :) Appreciate it.

There is currently no support for that, I'm afraid. It's been requested, but it's a bit complicated to get right. Pull requests welcome. I'd love to add it some time, but can't make any promises.

victorarias commented 6 years ago

You may find this closed pull request useful: https://github.com/barsoom/attr_extras/pull/16

DamirSvrtan commented 6 years ago

@victorarias what is the blocker to get this into the gem? What was the reason why you stopped thinking about merging it in?

victorarias commented 6 years ago

what is the blocker to get this into the gem?

The last batch of comments on the PR. Now there may be some merge conflicts to resolve, but it should be doable.

What was the reason why you stopped thinking about merging it in?

I think it was because there was a big delay between pushing "final" changes and and then getting blocking feedback for them. Since a considerable amount of time passed, I then had changed my priorities and I couldn't find the time and motivation to go back to change the code :/

henrik commented 5 years ago

Fixed in #26 by @lesin :)