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

Defaults on keywords arguments #56

Open
nazamoresco opened this issue Nov 28, 2022 · 0 comments
Open

Defaults on keywords arguments #56

nazamoresco opened this issue Nov 28, 2022 · 0 comments

Comments

@nazamoresco
Copy link

nazamoresco commented Nov 28, 2022

Hey👋
I'm using the gem a lot!
Would adding defaults with keyword arguments be something worth doing?
It shouldn't be hard, I can open a PR if you are interested.

Right now you can override the getters like this

ImmutableStruct.new(:attribute) do 
  def attribute
     @attribute || default
  end 
end

But it would be less verbose to do:

ImmutableStruct.new(attribute: default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant