Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Schema#load implementation suggestion
class Schema
def load source
...
add_fields_to_schema(schema, source_fields)
self
end
def add_fields_to_schema schema, fields
fields.each do |field|
column = schema.send(
:add_field,
field["name"],
field["type"],
mode: field["mode"],
description: field["description"]
)
next unless field["type"] == "RECORD"
add_fields_to_schema(column, field["fields"])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment