Created
August 29, 2016 15:48
-
-
Save cored/f8f9118aa57f8ca8d25ab47cdcc31c85 to your computer and use it in GitHub Desktop.
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
def node(input, *args) | |
if input.is_a?(::Symbol) | |
[type, [name, predicate(input, *args).to_ast]] | |
elsif input.respond_to?(:rule) | |
[type, [name, [:type, input]]] | |
elsif input.is_a?(::Class) && input < ::Dry::Struct | |
[type, [name, [:schema, Schema.create_class(self, input)]]] | |
elsif input.is_a?(Schema) | |
[type, [name, schema(input).to_ast]] | |
else | |
[type, [name, input.to_ast]] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment