Skip to content

Instantly share code, notes, and snippets.

@shioyama
Created June 11, 2019 07:44
Show Gist options
  • Save shioyama/6f67cb2c5916f66d6b4af3d3be2d119b to your computer and use it in GitHub Desktop.
Save shioyama/6f67cb2c5916f66d6b4af3d3be2d119b to your computer and use it in GitHub Desktop.
Force "optional" to really mean "optional"
# It's annoying to write meta(required: false) everywhere, so let's just make
# "optional" do the same thing.
Dry::Types::Builder.module_eval do
def optional
meta(required: false)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment