Skip to content

Defaults on keywords arguments #56

@nazamoresco

Description

@nazamoresco

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions