Created
June 11, 2019 07:44
-
-
Save shioyama/6f67cb2c5916f66d6b4af3d3be2d119b to your computer and use it in GitHub Desktop.
Force "optional" to really mean "optional"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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