-
-
Save indigoviolet/08333c5df6759b9fa0bb59c4c365ae08 to your computer and use it in GitHub Desktop.
fin blog embed
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
# class is_a? seems to get confused sometimes because the class gets redefined somehow (?) | |
Contract.override_validator(:class) do |klass| | |
# We try hard not to do `constantize` because that is slow | |
lambda do |arg| | |
return true if arg.is_a?(klass) | |
return true if arg.class.name == klass.name | |
return true if arg.is_a?(klass.name.constantize) | |
return false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment